[TS] Update auto-generated bindings to 0.0.116
[ldk-java] / ts / bindings.c
1 #define LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ LDKCVec_TransactionOutputsZ
2 #define CVec_C2Tuple_TxidCVec_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_PermanentFailure;
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_PermanentFailure: 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 LDKFailureCode LDKFailureCode_from_js(int32_t ord) {
358         switch (ord) {
359                 case 0: return LDKFailureCode_TemporaryNodeFailure;
360                 case 1: return LDKFailureCode_RequiredNodeFeatureMissing;
361                 case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails;
362         }
363         abort();
364 }
365 static inline int32_t LDKFailureCode_to_js(LDKFailureCode val) {
366         switch (val) {
367                 case LDKFailureCode_TemporaryNodeFailure: return 0;
368                 case LDKFailureCode_RequiredNodeFeatureMissing: return 1;
369                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2;
370                 default: abort();
371         }
372 }
373 static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) {
374         switch (ord) {
375                 case 0: return LDKHTLCClaim_OfferedTimeout;
376                 case 1: return LDKHTLCClaim_OfferedPreimage;
377                 case 2: return LDKHTLCClaim_AcceptedTimeout;
378                 case 3: return LDKHTLCClaim_AcceptedPreimage;
379                 case 4: return LDKHTLCClaim_Revocation;
380         }
381         abort();
382 }
383 static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) {
384         switch (val) {
385                 case LDKHTLCClaim_OfferedTimeout: return 0;
386                 case LDKHTLCClaim_OfferedPreimage: return 1;
387                 case LDKHTLCClaim_AcceptedTimeout: return 2;
388                 case LDKHTLCClaim_AcceptedPreimage: return 3;
389                 case LDKHTLCClaim_Revocation: return 4;
390                 default: abort();
391         }
392 }
393 static inline LDKIOError LDKIOError_from_js(int32_t ord) {
394         switch (ord) {
395                 case 0: return LDKIOError_NotFound;
396                 case 1: return LDKIOError_PermissionDenied;
397                 case 2: return LDKIOError_ConnectionRefused;
398                 case 3: return LDKIOError_ConnectionReset;
399                 case 4: return LDKIOError_ConnectionAborted;
400                 case 5: return LDKIOError_NotConnected;
401                 case 6: return LDKIOError_AddrInUse;
402                 case 7: return LDKIOError_AddrNotAvailable;
403                 case 8: return LDKIOError_BrokenPipe;
404                 case 9: return LDKIOError_AlreadyExists;
405                 case 10: return LDKIOError_WouldBlock;
406                 case 11: return LDKIOError_InvalidInput;
407                 case 12: return LDKIOError_InvalidData;
408                 case 13: return LDKIOError_TimedOut;
409                 case 14: return LDKIOError_WriteZero;
410                 case 15: return LDKIOError_Interrupted;
411                 case 16: return LDKIOError_Other;
412                 case 17: return LDKIOError_UnexpectedEof;
413         }
414         abort();
415 }
416 static inline int32_t LDKIOError_to_js(LDKIOError val) {
417         switch (val) {
418                 case LDKIOError_NotFound: return 0;
419                 case LDKIOError_PermissionDenied: return 1;
420                 case LDKIOError_ConnectionRefused: return 2;
421                 case LDKIOError_ConnectionReset: return 3;
422                 case LDKIOError_ConnectionAborted: return 4;
423                 case LDKIOError_NotConnected: return 5;
424                 case LDKIOError_AddrInUse: return 6;
425                 case LDKIOError_AddrNotAvailable: return 7;
426                 case LDKIOError_BrokenPipe: return 8;
427                 case LDKIOError_AlreadyExists: return 9;
428                 case LDKIOError_WouldBlock: return 10;
429                 case LDKIOError_InvalidInput: return 11;
430                 case LDKIOError_InvalidData: return 12;
431                 case LDKIOError_TimedOut: return 13;
432                 case LDKIOError_WriteZero: return 14;
433                 case LDKIOError_Interrupted: return 15;
434                 case LDKIOError_Other: return 16;
435                 case LDKIOError_UnexpectedEof: return 17;
436                 default: abort();
437         }
438 }
439 static inline LDKLevel LDKLevel_from_js(int32_t ord) {
440         switch (ord) {
441                 case 0: return LDKLevel_Gossip;
442                 case 1: return LDKLevel_Trace;
443                 case 2: return LDKLevel_Debug;
444                 case 3: return LDKLevel_Info;
445                 case 4: return LDKLevel_Warn;
446                 case 5: return LDKLevel_Error;
447         }
448         abort();
449 }
450 static inline int32_t LDKLevel_to_js(LDKLevel val) {
451         switch (val) {
452                 case LDKLevel_Gossip: return 0;
453                 case LDKLevel_Trace: return 1;
454                 case LDKLevel_Debug: return 2;
455                 case LDKLevel_Info: return 3;
456                 case LDKLevel_Warn: return 4;
457                 case LDKLevel_Error: return 5;
458                 default: abort();
459         }
460 }
461 static inline LDKNetwork LDKNetwork_from_js(int32_t ord) {
462         switch (ord) {
463                 case 0: return LDKNetwork_Bitcoin;
464                 case 1: return LDKNetwork_Testnet;
465                 case 2: return LDKNetwork_Regtest;
466                 case 3: return LDKNetwork_Signet;
467         }
468         abort();
469 }
470 static inline int32_t LDKNetwork_to_js(LDKNetwork val) {
471         switch (val) {
472                 case LDKNetwork_Bitcoin: return 0;
473                 case LDKNetwork_Testnet: return 1;
474                 case LDKNetwork_Regtest: return 2;
475                 case LDKNetwork_Signet: return 3;
476                 default: abort();
477         }
478 }
479 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_js(int32_t ord) {
480         switch (ord) {
481                 case 0: return LDKPaymentFailureReason_RecipientRejected;
482                 case 1: return LDKPaymentFailureReason_UserAbandoned;
483                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
484                 case 3: return LDKPaymentFailureReason_PaymentExpired;
485                 case 4: return LDKPaymentFailureReason_RouteNotFound;
486                 case 5: return LDKPaymentFailureReason_UnexpectedError;
487         }
488         abort();
489 }
490 static inline int32_t LDKPaymentFailureReason_to_js(LDKPaymentFailureReason val) {
491         switch (val) {
492                 case LDKPaymentFailureReason_RecipientRejected: return 0;
493                 case LDKPaymentFailureReason_UserAbandoned: return 1;
494                 case LDKPaymentFailureReason_RetriesExhausted: return 2;
495                 case LDKPaymentFailureReason_PaymentExpired: return 3;
496                 case LDKPaymentFailureReason_RouteNotFound: return 4;
497                 case LDKPaymentFailureReason_UnexpectedError: return 5;
498                 default: abort();
499         }
500 }
501 static inline LDKRecipient LDKRecipient_from_js(int32_t ord) {
502         switch (ord) {
503                 case 0: return LDKRecipient_Node;
504                 case 1: return LDKRecipient_PhantomNode;
505         }
506         abort();
507 }
508 static inline int32_t LDKRecipient_to_js(LDKRecipient val) {
509         switch (val) {
510                 case LDKRecipient_Node: return 0;
511                 case LDKRecipient_PhantomNode: return 1;
512                 default: abort();
513         }
514 }
515 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) {
516         switch (ord) {
517                 case 0: return LDKRetryableSendFailure_PaymentExpired;
518                 case 1: return LDKRetryableSendFailure_RouteNotFound;
519                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
520         }
521         abort();
522 }
523 static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) {
524         switch (val) {
525                 case LDKRetryableSendFailure_PaymentExpired: return 0;
526                 case LDKRetryableSendFailure_RouteNotFound: return 1;
527                 case LDKRetryableSendFailure_DuplicatePayment: return 2;
528                 default: abort();
529         }
530 }
531 static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) {
532         switch (ord) {
533                 case 0: return LDKSecp256k1Error_IncorrectSignature;
534                 case 1: return LDKSecp256k1Error_InvalidMessage;
535                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
536                 case 3: return LDKSecp256k1Error_InvalidSignature;
537                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
538                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
539                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
540                 case 7: return LDKSecp256k1Error_InvalidTweak;
541                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
542                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
543                 case 10: return LDKSecp256k1Error_InvalidParityValue;
544         }
545         abort();
546 }
547 static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) {
548         switch (val) {
549                 case LDKSecp256k1Error_IncorrectSignature: return 0;
550                 case LDKSecp256k1Error_InvalidMessage: return 1;
551                 case LDKSecp256k1Error_InvalidPublicKey: return 2;
552                 case LDKSecp256k1Error_InvalidSignature: return 3;
553                 case LDKSecp256k1Error_InvalidSecretKey: return 4;
554                 case LDKSecp256k1Error_InvalidSharedSecret: return 5;
555                 case LDKSecp256k1Error_InvalidRecoveryId: return 6;
556                 case LDKSecp256k1Error_InvalidTweak: return 7;
557                 case LDKSecp256k1Error_NotEnoughMemory: return 8;
558                 case LDKSecp256k1Error_InvalidPublicKeySum: return 9;
559                 case LDKSecp256k1Error_InvalidParityValue: return 10;
560                 default: abort();
561         }
562 }
563 static inline LDKSiPrefix LDKSiPrefix_from_js(int32_t ord) {
564         switch (ord) {
565                 case 0: return LDKSiPrefix_Milli;
566                 case 1: return LDKSiPrefix_Micro;
567                 case 2: return LDKSiPrefix_Nano;
568                 case 3: return LDKSiPrefix_Pico;
569         }
570         abort();
571 }
572 static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) {
573         switch (val) {
574                 case LDKSiPrefix_Milli: return 0;
575                 case LDKSiPrefix_Micro: return 1;
576                 case LDKSiPrefix_Nano: return 2;
577                 case LDKSiPrefix_Pico: return 3;
578                 default: abort();
579         }
580 }
581 static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) {
582         switch (ord) {
583                 case 0: return LDKUtxoLookupError_UnknownChain;
584                 case 1: return LDKUtxoLookupError_UnknownTx;
585         }
586         abort();
587 }
588 static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) {
589         switch (val) {
590                 case LDKUtxoLookupError_UnknownChain: return 0;
591                 case LDKUtxoLookupError_UnknownTx: return 1;
592                 default: abort();
593         }
594 }
595 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
596         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
597         return ret;
598 }
599 int8_tArray  __attribute__((export_name("TS_BigEndianScalar_get_bytes"))) TS_BigEndianScalar_get_bytes(uint64_t thing) {
600         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
601         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
602         memcpy(ret_arr->elems, BigEndianScalar_get_bytes(thing_conv).data, 32);
603         return ret_arr;
604 }
605
606 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
607 void  __attribute__((export_name("TS_BigEndianScalar_free"))) TS_BigEndianScalar_free(uint64_t thing) {
608         if (!ptr_is_owned(thing)) return;
609         void* thing_ptr = untag_ptr(thing);
610         CHECK_ACCESS(thing_ptr);
611         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
612         FREE(untag_ptr(thing));
613         BigEndianScalar_free(thing_conv);
614 }
615
616 uint32_t __attribute__((export_name("TS_LDKBech32Error_ty_from_ptr"))) TS_LDKBech32Error_ty_from_ptr(uint64_t ptr) {
617         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
618         switch(obj->tag) {
619                 case LDKBech32Error_MissingSeparator: return 0;
620                 case LDKBech32Error_InvalidChecksum: return 1;
621                 case LDKBech32Error_InvalidLength: return 2;
622                 case LDKBech32Error_InvalidChar: return 3;
623                 case LDKBech32Error_InvalidData: return 4;
624                 case LDKBech32Error_InvalidPadding: return 5;
625                 case LDKBech32Error_MixedCase: return 6;
626                 default: abort();
627         }
628 }
629 int32_t __attribute__((export_name("TS_LDKBech32Error_InvalidChar_get_invalid_char"))) TS_LDKBech32Error_InvalidChar_get_invalid_char(uint64_t ptr) {
630         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
631         assert(obj->tag == LDKBech32Error_InvalidChar);
632                         int32_t invalid_char_conv = obj->invalid_char;
633         return invalid_char_conv;
634 }
635 int8_t __attribute__((export_name("TS_LDKBech32Error_InvalidData_get_invalid_data"))) TS_LDKBech32Error_InvalidData_get_invalid_data(uint64_t ptr) {
636         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
637         assert(obj->tag == LDKBech32Error_InvalidData);
638                         int8_t invalid_data_conv = obj->invalid_data;
639         return invalid_data_conv;
640 }
641 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
642         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
643         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
644         return ret;
645 }
646 struct LDKWitness TxIn_get_witness (struct LDKTxIn* thing) {    return Witness_clone(&thing->witness);}int8_tArray  __attribute__((export_name("TS_TxIn_get_witness"))) TS_TxIn_get_witness(uint64_t thing) {
647         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
648         LDKWitness ret_var = TxIn_get_witness(thing_conv);
649         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
650         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
651         Witness_free(ret_var);
652         return ret_arr;
653 }
654
655 struct LDKCVec_u8Z TxIn_get_script_sig (struct LDKTxIn* thing) {        return CVec_u8Z_clone(&thing->script_sig);}int8_tArray  __attribute__((export_name("TS_TxIn_get_script_sig"))) TS_TxIn_get_script_sig(uint64_t thing) {
656         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
657         LDKCVec_u8Z ret_var = TxIn_get_script_sig(thing_conv);
658         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
659         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
660         CVec_u8Z_free(ret_var);
661         return ret_arr;
662 }
663
664 LDKThirtyTwoBytes TxIn_get_previous_txid (struct LDKTxIn* thing) {      return thing->previous_txid;}int8_tArray  __attribute__((export_name("TS_TxIn_get_previous_txid"))) TS_TxIn_get_previous_txid(uint64_t thing) {
665         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
666         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
667         memcpy(ret_arr->elems, TxIn_get_previous_txid(thing_conv).data, 32);
668         return ret_arr;
669 }
670
671 uint32_t TxIn_get_previous_vout (struct LDKTxIn* thing) {       return thing->previous_vout;}int32_t  __attribute__((export_name("TS_TxIn_get_previous_vout"))) TS_TxIn_get_previous_vout(uint64_t thing) {
672         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
673         int32_t ret_conv = TxIn_get_previous_vout(thing_conv);
674         return ret_conv;
675 }
676
677 uint32_t TxIn_get_sequence (struct LDKTxIn* thing) {    return thing->sequence;}int32_t  __attribute__((export_name("TS_TxIn_get_sequence"))) TS_TxIn_get_sequence(uint64_t thing) {
678         LDKTxIn* thing_conv = (LDKTxIn*)untag_ptr(thing);
679         int32_t ret_conv = TxIn_get_sequence(thing_conv);
680         return ret_conv;
681 }
682
683 struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) {   return CVec_u8Z_clone(&thing->script_pubkey);}int8_tArray  __attribute__((export_name("TS_TxOut_get_script_pubkey"))) TS_TxOut_get_script_pubkey(uint64_t thing) {
684         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
685         LDKCVec_u8Z ret_var = TxOut_get_script_pubkey(thing_conv);
686         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
687         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
688         CVec_u8Z_free(ret_var);
689         return ret_arr;
690 }
691
692 uint64_t TxOut_get_value (struct LDKTxOut* thing) {     return thing->value;}int64_t  __attribute__((export_name("TS_TxOut_get_value"))) TS_TxOut_get_value(uint64_t thing) {
693         LDKTxOut* thing_conv = (LDKTxOut*)untag_ptr(thing);
694         int64_t ret_conv = TxOut_get_value(thing_conv);
695         return ret_conv;
696 }
697
698 uint32_t __attribute__((export_name("TS_LDKCOption_DurationZ_ty_from_ptr"))) TS_LDKCOption_DurationZ_ty_from_ptr(uint64_t ptr) {
699         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
700         switch(obj->tag) {
701                 case LDKCOption_DurationZ_Some: return 0;
702                 case LDKCOption_DurationZ_None: return 1;
703                 default: abort();
704         }
705 }
706 int64_t __attribute__((export_name("TS_LDKCOption_DurationZ_Some_get_some"))) TS_LDKCOption_DurationZ_Some_get_some(uint64_t ptr) {
707         LDKCOption_DurationZ *obj = (LDKCOption_DurationZ*)untag_ptr(ptr);
708         assert(obj->tag == LDKCOption_DurationZ_Some);
709                         int64_t some_conv = obj->some;
710         return some_conv;
711 }
712 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
713         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
714         for (size_t i = 0; i < ret.datalen; i++) {
715                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
716         }
717         return ret;
718 }
719 uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) {
720         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
721         switch(obj->tag) {
722                 case LDKCOption_u64Z_Some: return 0;
723                 case LDKCOption_u64Z_None: return 1;
724                 default: abort();
725         }
726 }
727 int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) {
728         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
729         assert(obj->tag == LDKCOption_u64Z_Some);
730                         int64_t some_conv = obj->some;
731         return some_conv;
732 }
733 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
734         LDKRefund ret = *owner->contents.result;
735         ret.is_owned = false;
736         return ret;
737 }
738 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_ok"))) TS_CResult_RefundBolt12ParseErrorZ_get_ok(uint64_t owner) {
739         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
740         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
741         uint64_t ret_ref = 0;
742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
744         return ret_ref;
745 }
746
747 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
748         LDKBolt12ParseError ret = *owner->contents.err;
749         ret.is_owned = false;
750         return ret;
751 }
752 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_get_err"))) TS_CResult_RefundBolt12ParseErrorZ_get_err(uint64_t owner) {
753         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
754         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
755         uint64_t ret_ref = 0;
756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
758         return ret_ref;
759 }
760
761 uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) {
762         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
763         switch(obj->tag) {
764                 case LDKAPIError_APIMisuseError: return 0;
765                 case LDKAPIError_FeeRateTooHigh: return 1;
766                 case LDKAPIError_InvalidRoute: return 2;
767                 case LDKAPIError_ChannelUnavailable: return 3;
768                 case LDKAPIError_MonitorUpdateInProgress: return 4;
769                 case LDKAPIError_IncompatibleShutdownScript: return 5;
770                 default: abort();
771         }
772 }
773 jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) {
774         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
775         assert(obj->tag == LDKAPIError_APIMisuseError);
776                         LDKStr err_str = obj->api_misuse_error.err;
777                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
778         return err_conv;
779 }
780 jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) {
781         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
782         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
783                         LDKStr err_str = obj->fee_rate_too_high.err;
784                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
785         return err_conv;
786 }
787 int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) {
788         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
789         assert(obj->tag == LDKAPIError_FeeRateTooHigh);
790                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
791         return feerate_conv;
792 }
793 jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) {
794         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
795         assert(obj->tag == LDKAPIError_InvalidRoute);
796                         LDKStr err_str = obj->invalid_route.err;
797                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
798         return err_conv;
799 }
800 jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) {
801         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
802         assert(obj->tag == LDKAPIError_ChannelUnavailable);
803                         LDKStr err_str = obj->channel_unavailable.err;
804                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
805         return err_conv;
806 }
807 uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) {
808         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
809         assert(obj->tag == LDKAPIError_IncompatibleShutdownScript);
810                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
811                         uint64_t script_ref = 0;
812                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
813                         script_ref = tag_ptr(script_var.inner, false);
814         return script_ref;
815 }
816 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
817 CHECK(owner->result_ok);
818         return *owner->contents.result;
819 }
820 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) {
821         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
822         CResult_NoneAPIErrorZ_get_ok(owner_conv);
823 }
824
825 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
826 CHECK(!owner->result_ok);
827         return APIError_clone(&*owner->contents.err);
828 }
829 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) {
830         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
831         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
832         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
833         uint64_t ret_ref = tag_ptr(ret_copy, true);
834         return ret_ref;
835 }
836
837 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
838         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
839         for (size_t i = 0; i < ret.datalen; i++) {
840                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
841         }
842         return ret;
843 }
844 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
845         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
846         for (size_t i = 0; i < ret.datalen; i++) {
847                 ret.data[i] = APIError_clone(&orig->data[i]);
848         }
849         return ret;
850 }
851 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentSecretZ_ty_from_ptr"))) TS_LDKCOption_PaymentSecretZ_ty_from_ptr(uint64_t ptr) {
852         LDKCOption_PaymentSecretZ *obj = (LDKCOption_PaymentSecretZ*)untag_ptr(ptr);
853         switch(obj->tag) {
854                 case LDKCOption_PaymentSecretZ_Some: return 0;
855                 case LDKCOption_PaymentSecretZ_None: return 1;
856                 default: abort();
857         }
858 }
859 int8_tArray __attribute__((export_name("TS_LDKCOption_PaymentSecretZ_Some_get_some"))) TS_LDKCOption_PaymentSecretZ_Some_get_some(uint64_t ptr) {
860         LDKCOption_PaymentSecretZ *obj = (LDKCOption_PaymentSecretZ*)untag_ptr(ptr);
861         assert(obj->tag == LDKCOption_PaymentSecretZ_Some);
862                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
863                         memcpy(some_arr->elems, obj->some.data, 32);
864         return some_arr;
865 }
866 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_ty_from_ptr"))) TS_LDKCOption_CVec_u8ZZ_ty_from_ptr(uint64_t ptr) {
867         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
868         switch(obj->tag) {
869                 case LDKCOption_CVec_u8ZZ_Some: return 0;
870                 case LDKCOption_CVec_u8ZZ_None: return 1;
871                 default: abort();
872         }
873 }
874 int8_tArray __attribute__((export_name("TS_LDKCOption_CVec_u8ZZ_Some_get_some"))) TS_LDKCOption_CVec_u8ZZ_Some_get_some(uint64_t ptr) {
875         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
876         assert(obj->tag == LDKCOption_CVec_u8ZZ_Some);
877                         LDKCVec_u8Z some_var = obj->some;
878                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
879                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
880         return some_arr;
881 }
882 uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) {
883         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
884         switch(obj->tag) {
885                 case LDKDecodeError_UnknownVersion: return 0;
886                 case LDKDecodeError_UnknownRequiredFeature: return 1;
887                 case LDKDecodeError_InvalidValue: return 2;
888                 case LDKDecodeError_ShortRead: return 3;
889                 case LDKDecodeError_BadLengthDescriptor: return 4;
890                 case LDKDecodeError_Io: return 5;
891                 case LDKDecodeError_UnsupportedCompression: return 6;
892                 default: abort();
893         }
894 }
895 uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecodeError_Io_get_io(uint64_t ptr) {
896         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
897         assert(obj->tag == LDKDecodeError_Io);
898                         uint32_t io_conv = LDKIOError_to_js(obj->io);
899         return io_conv;
900 }
901 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
902         LDKRecipientOnionFields ret = *owner->contents.result;
903         ret.is_owned = false;
904         return ret;
905 }
906 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(uint64_t owner) {
907         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
908         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
909         uint64_t ret_ref = 0;
910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
912         return ret_ref;
913 }
914
915 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
916 CHECK(!owner->result_ok);
917         return DecodeError_clone(&*owner->contents.err);
918 }
919 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_get_err(uint64_t owner) {
920         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
921         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
922         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
923         uint64_t ret_ref = tag_ptr(ret_copy, true);
924         return ret_ref;
925 }
926
927 uint32_t __attribute__((export_name("TS_LDKOffersMessage_ty_from_ptr"))) TS_LDKOffersMessage_ty_from_ptr(uint64_t ptr) {
928         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
929         switch(obj->tag) {
930                 case LDKOffersMessage_InvoiceRequest: return 0;
931                 case LDKOffersMessage_Invoice: return 1;
932                 case LDKOffersMessage_InvoiceError: return 2;
933                 default: abort();
934         }
935 }
936 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceRequest_get_invoice_request"))) TS_LDKOffersMessage_InvoiceRequest_get_invoice_request(uint64_t ptr) {
937         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
938         assert(obj->tag == LDKOffersMessage_InvoiceRequest);
939                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
940                         uint64_t invoice_request_ref = 0;
941                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
942                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
943         return invoice_request_ref;
944 }
945 uint64_t __attribute__((export_name("TS_LDKOffersMessage_Invoice_get_invoice"))) TS_LDKOffersMessage_Invoice_get_invoice(uint64_t ptr) {
946         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
947         assert(obj->tag == LDKOffersMessage_Invoice);
948                         LDKBolt12Invoice invoice_var = obj->invoice;
949                         uint64_t invoice_ref = 0;
950                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
951                         invoice_ref = tag_ptr(invoice_var.inner, false);
952         return invoice_ref;
953 }
954 uint64_t __attribute__((export_name("TS_LDKOffersMessage_InvoiceError_get_invoice_error"))) TS_LDKOffersMessage_InvoiceError_get_invoice_error(uint64_t ptr) {
955         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
956         assert(obj->tag == LDKOffersMessage_InvoiceError);
957                         LDKInvoiceError invoice_error_var = obj->invoice_error;
958                         uint64_t invoice_error_ref = 0;
959                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
960                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
961         return invoice_error_ref;
962 }
963 uint32_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_ty_from_ptr"))) TS_LDKCOption_OffersMessageZ_ty_from_ptr(uint64_t ptr) {
964         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
965         switch(obj->tag) {
966                 case LDKCOption_OffersMessageZ_Some: return 0;
967                 case LDKCOption_OffersMessageZ_None: return 1;
968                 default: abort();
969         }
970 }
971 uint64_t __attribute__((export_name("TS_LDKCOption_OffersMessageZ_Some_get_some"))) TS_LDKCOption_OffersMessageZ_Some_get_some(uint64_t ptr) {
972         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
973         assert(obj->tag == LDKCOption_OffersMessageZ_Some);
974                         uint64_t some_ref = tag_ptr(&obj->some, false);
975         return some_ref;
976 }
977 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
978 CHECK(owner->result_ok);
979         return OffersMessage_clone(&*owner->contents.result);
980 }
981 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_ok"))) TS_CResult_OffersMessageDecodeErrorZ_get_ok(uint64_t owner) {
982         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
983         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
984         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
985         uint64_t ret_ref = tag_ptr(ret_copy, true);
986         return ret_ref;
987 }
988
989 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
990 CHECK(!owner->result_ok);
991         return DecodeError_clone(&*owner->contents.err);
992 }
993 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_get_err"))) TS_CResult_OffersMessageDecodeErrorZ_get_err(uint64_t owner) {
994         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
995         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
996         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
997         uint64_t ret_ref = tag_ptr(ret_copy, true);
998         return ret_ref;
999 }
1000
1001 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) {
1002         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
1003         switch(obj->tag) {
1004                 case LDKCOption_HTLCClaimZ_Some: return 0;
1005                 case LDKCOption_HTLCClaimZ_None: return 1;
1006                 default: abort();
1007         }
1008 }
1009 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) {
1010         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
1011         assert(obj->tag == LDKCOption_HTLCClaimZ_Some);
1012                         uint32_t some_conv = LDKHTLCClaim_to_js(obj->some);
1013         return some_conv;
1014 }
1015 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1016 CHECK(owner->result_ok);
1017         return *owner->contents.result;
1018 }
1019 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) {
1020         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1021         CResult_NoneNoneZ_get_ok(owner_conv);
1022 }
1023
1024 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
1025 CHECK(!owner->result_ok);
1026         return *owner->contents.err;
1027 }
1028 void  __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) {
1029         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
1030         CResult_NoneNoneZ_get_err(owner_conv);
1031 }
1032
1033 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1034         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
1035         ret.is_owned = false;
1036         return ret;
1037 }
1038 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(uint64_t owner) {
1039         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1040         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
1041         uint64_t ret_ref = 0;
1042         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1043         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1044         return ret_ref;
1045 }
1046
1047 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
1048 CHECK(!owner->result_ok);
1049         return DecodeError_clone(&*owner->contents.err);
1050 }
1051 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(uint64_t owner) {
1052         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
1053         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1054         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
1055         uint64_t ret_ref = tag_ptr(ret_copy, true);
1056         return ret_ref;
1057 }
1058
1059 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1060         LDKTxCreationKeys ret = *owner->contents.result;
1061         ret.is_owned = false;
1062         return ret;
1063 }
1064 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_ok(uint64_t owner) {
1065         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1066         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
1067         uint64_t ret_ref = 0;
1068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1070         return ret_ref;
1071 }
1072
1073 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
1074 CHECK(!owner->result_ok);
1075         return DecodeError_clone(&*owner->contents.err);
1076 }
1077 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_get_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_get_err(uint64_t owner) {
1078         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
1079         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1080         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
1081         uint64_t ret_ref = tag_ptr(ret_copy, true);
1082         return ret_ref;
1083 }
1084
1085 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1086         LDKChannelPublicKeys ret = *owner->contents.result;
1087         ret.is_owned = false;
1088         return ret;
1089 }
1090 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_ok(uint64_t owner) {
1091         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1092         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
1093         uint64_t ret_ref = 0;
1094         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1095         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1096         return ret_ref;
1097 }
1098
1099 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
1100 CHECK(!owner->result_ok);
1101         return DecodeError_clone(&*owner->contents.err);
1102 }
1103 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_get_err(uint64_t owner) {
1104         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
1105         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1106         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
1107         uint64_t ret_ref = tag_ptr(ret_copy, true);
1108         return ret_ref;
1109 }
1110
1111 uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) {
1112         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1113         switch(obj->tag) {
1114                 case LDKCOption_u32Z_Some: return 0;
1115                 case LDKCOption_u32Z_None: return 1;
1116                 default: abort();
1117         }
1118 }
1119 int32_t __attribute__((export_name("TS_LDKCOption_u32Z_Some_get_some"))) TS_LDKCOption_u32Z_Some_get_some(uint64_t ptr) {
1120         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
1121         assert(obj->tag == LDKCOption_u32Z_Some);
1122                         int32_t some_conv = obj->some;
1123         return some_conv;
1124 }
1125 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1126         LDKHTLCOutputInCommitment ret = *owner->contents.result;
1127         ret.is_owned = false;
1128         return ret;
1129 }
1130 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(uint64_t owner) {
1131         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1132         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
1133         uint64_t ret_ref = 0;
1134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1136         return ret_ref;
1137 }
1138
1139 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
1140 CHECK(!owner->result_ok);
1141         return DecodeError_clone(&*owner->contents.err);
1142 }
1143 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(uint64_t owner) {
1144         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
1145         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1146         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
1147         uint64_t ret_ref = tag_ptr(ret_copy, true);
1148         return ret_ref;
1149 }
1150
1151 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentPreimageZ_ty_from_ptr"))) TS_LDKCOption_PaymentPreimageZ_ty_from_ptr(uint64_t ptr) {
1152         LDKCOption_PaymentPreimageZ *obj = (LDKCOption_PaymentPreimageZ*)untag_ptr(ptr);
1153         switch(obj->tag) {
1154                 case LDKCOption_PaymentPreimageZ_Some: return 0;
1155                 case LDKCOption_PaymentPreimageZ_None: return 1;
1156                 default: abort();
1157         }
1158 }
1159 int8_tArray __attribute__((export_name("TS_LDKCOption_PaymentPreimageZ_Some_get_some"))) TS_LDKCOption_PaymentPreimageZ_Some_get_some(uint64_t ptr) {
1160         LDKCOption_PaymentPreimageZ *obj = (LDKCOption_PaymentPreimageZ*)untag_ptr(ptr);
1161         assert(obj->tag == LDKCOption_PaymentPreimageZ_Some);
1162                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
1163                         memcpy(some_arr->elems, obj->some.data, 32);
1164         return some_arr;
1165 }
1166 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1167         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
1168         ret.is_owned = false;
1169         return ret;
1170 }
1171 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
1172         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1173         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1174         uint64_t ret_ref = 0;
1175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1177         return ret_ref;
1178 }
1179
1180 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1181 CHECK(!owner->result_ok);
1182         return DecodeError_clone(&*owner->contents.err);
1183 }
1184 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
1185         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1186         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1187         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1188         uint64_t ret_ref = tag_ptr(ret_copy, true);
1189         return ret_ref;
1190 }
1191
1192 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1193         LDKChannelTransactionParameters ret = *owner->contents.result;
1194         ret.is_owned = false;
1195         return ret;
1196 }
1197 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(uint64_t owner) {
1198         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1199         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
1200         uint64_t ret_ref = 0;
1201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1203         return ret_ref;
1204 }
1205
1206 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
1207 CHECK(!owner->result_ok);
1208         return DecodeError_clone(&*owner->contents.err);
1209 }
1210 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_get_err(uint64_t owner) {
1211         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
1212         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1213         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
1214         uint64_t ret_ref = tag_ptr(ret_copy, true);
1215         return ret_ref;
1216 }
1217
1218 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1219         LDKHolderCommitmentTransaction ret = *owner->contents.result;
1220         ret.is_owned = false;
1221         return ret;
1222 }
1223 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
1224         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1225         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1226         uint64_t ret_ref = 0;
1227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1229         return ret_ref;
1230 }
1231
1232 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1233 CHECK(!owner->result_ok);
1234         return DecodeError_clone(&*owner->contents.err);
1235 }
1236 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1237         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1238         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1239         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1240         uint64_t ret_ref = tag_ptr(ret_copy, true);
1241         return ret_ref;
1242 }
1243
1244 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1245         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
1246         ret.is_owned = false;
1247         return ret;
1248 }
1249 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
1250         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1251         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1252         uint64_t ret_ref = 0;
1253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1255         return ret_ref;
1256 }
1257
1258 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1259 CHECK(!owner->result_ok);
1260         return DecodeError_clone(&*owner->contents.err);
1261 }
1262 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1263         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1264         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1265         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1266         uint64_t ret_ref = tag_ptr(ret_copy, true);
1267         return ret_ref;
1268 }
1269
1270 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1271         LDKTrustedClosingTransaction ret = *owner->contents.result;
1272         ret.is_owned = false;
1273         return ret;
1274 }
1275 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_get_ok(uint64_t owner) {
1276         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1277         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
1278         uint64_t ret_ref = 0;
1279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1281         return ret_ref;
1282 }
1283
1284 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
1285 CHECK(!owner->result_ok);
1286         return *owner->contents.err;
1287 }
1288 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_get_err"))) TS_CResult_TrustedClosingTransactionNoneZ_get_err(uint64_t owner) {
1289         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
1290         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
1291 }
1292
1293 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1294         LDKCommitmentTransaction ret = *owner->contents.result;
1295         ret.is_owned = false;
1296         return ret;
1297 }
1298 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_ok(uint64_t owner) {
1299         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1300         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
1301         uint64_t ret_ref = 0;
1302         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1303         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1304         return ret_ref;
1305 }
1306
1307 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
1308 CHECK(!owner->result_ok);
1309         return DecodeError_clone(&*owner->contents.err);
1310 }
1311 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_get_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_get_err(uint64_t owner) {
1312         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
1313         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1314         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
1315         uint64_t ret_ref = tag_ptr(ret_copy, true);
1316         return ret_ref;
1317 }
1318
1319 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1320         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
1321         ret.is_owned = false;
1322         return ret;
1323 }
1324 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_ok(uint64_t owner) {
1325         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1326         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
1327         uint64_t ret_ref = 0;
1328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1330         return ret_ref;
1331 }
1332
1333 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
1334 CHECK(!owner->result_ok);
1335         return *owner->contents.err;
1336 }
1337 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_get_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_get_err(uint64_t owner) {
1338         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
1339         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
1340 }
1341
1342 static inline struct LDKCVec_SignatureZ CResult_CVec_SignatureZNoneZ_get_ok(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1343 CHECK(owner->result_ok);
1344         return *owner->contents.result;
1345 }
1346 ptrArray  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_ok"))) TS_CResult_CVec_SignatureZNoneZ_get_ok(uint64_t owner) {
1347         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1348         LDKCVec_SignatureZ ret_var = CResult_CVec_SignatureZNoneZ_get_ok(owner_conv);
1349         ptrArray ret_arr = NULL;
1350         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1351         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1352         for (size_t m = 0; m < ret_var.datalen; m++) {
1353                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1354                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1355                 ret_arr_ptr[m] = ret_conv_12_arr;
1356         }
1357         
1358         return ret_arr;
1359 }
1360
1361 static inline void CResult_CVec_SignatureZNoneZ_get_err(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR owner){
1362 CHECK(!owner->result_ok);
1363         return *owner->contents.err;
1364 }
1365 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_get_err"))) TS_CResult_CVec_SignatureZNoneZ_get_err(uint64_t owner) {
1366         LDKCResult_CVec_SignatureZNoneZ* owner_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(owner);
1367         CResult_CVec_SignatureZNoneZ_get_err(owner_conv);
1368 }
1369
1370 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1371         LDKShutdownScript ret = *owner->contents.result;
1372         ret.is_owned = false;
1373         return ret;
1374 }
1375 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_ok(uint64_t owner) {
1376         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1377         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
1378         uint64_t ret_ref = 0;
1379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1381         return ret_ref;
1382 }
1383
1384 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
1385 CHECK(!owner->result_ok);
1386         return DecodeError_clone(&*owner->contents.err);
1387 }
1388 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_get_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_get_err(uint64_t owner) {
1389         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
1390         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1391         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
1392         uint64_t ret_ref = tag_ptr(ret_copy, true);
1393         return ret_ref;
1394 }
1395
1396 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1397         LDKShutdownScript ret = *owner->contents.result;
1398         ret.is_owned = false;
1399         return ret;
1400 }
1401 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint64_t owner) {
1402         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1403         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
1404         uint64_t ret_ref = 0;
1405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1407         return ret_ref;
1408 }
1409
1410 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
1411         LDKInvalidShutdownScript ret = *owner->contents.err;
1412         ret.is_owned = false;
1413         return ret;
1414 }
1415 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint64_t owner) {
1416         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
1417         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
1418         uint64_t ret_ref = 0;
1419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1421         return ret_ref;
1422 }
1423
1424 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1425         LDKBlindedPayInfo ret = *owner->contents.result;
1426         ret.is_owned = false;
1427         return ret;
1428 }
1429 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_ok(uint64_t owner) {
1430         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1431         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
1432         uint64_t ret_ref = 0;
1433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1435         return ret_ref;
1436 }
1437
1438 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
1439 CHECK(!owner->result_ok);
1440         return DecodeError_clone(&*owner->contents.err);
1441 }
1442 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_get_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_get_err(uint64_t owner) {
1443         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
1444         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1445         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
1446         uint64_t ret_ref = tag_ptr(ret_copy, true);
1447         return ret_ref;
1448 }
1449
1450 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1451         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
1452         ret.is_owned = false;
1453         return ret;
1454 }
1455 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1456         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1457         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1458         uint64_t ret_ref = 0;
1459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1461         return ret_ref;
1462 }
1463
1464 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1465 CHECK(!owner->result_ok);
1466         return DecodeError_clone(&*owner->contents.err);
1467 }
1468 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1469         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1470         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1471         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1472         uint64_t ret_ref = tag_ptr(ret_copy, true);
1473         return ret_ref;
1474 }
1475
1476 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1477         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
1478         ret.is_owned = false;
1479         return ret;
1480 }
1481 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1482         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1483         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1484         uint64_t ret_ref = 0;
1485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1487         return ret_ref;
1488 }
1489
1490 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1491 CHECK(!owner->result_ok);
1492         return DecodeError_clone(&*owner->contents.err);
1493 }
1494 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1495         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1496         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1497         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1498         uint64_t ret_ref = tag_ptr(ret_copy, true);
1499         return ret_ref;
1500 }
1501
1502 uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) {
1503         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1504         switch(obj->tag) {
1505                 case LDKSpendableOutputDescriptor_StaticOutput: return 0;
1506                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: return 1;
1507                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: return 2;
1508                 default: abort();
1509         }
1510 }
1511 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_outpoint(uint64_t ptr) {
1512         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1513         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1514                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
1515                         uint64_t outpoint_ref = 0;
1516                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
1517                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
1518         return outpoint_ref;
1519 }
1520 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticOutput_get_output"))) TS_LDKSpendableOutputDescriptor_StaticOutput_get_output(uint64_t ptr) {
1521         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1522         assert(obj->tag == LDKSpendableOutputDescriptor_StaticOutput);
1523                         LDKTxOut* output_ref = &obj->static_output.output;
1524         return tag_ptr(output_ref, false);
1525 }
1526 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output"))) TS_LDKSpendableOutputDescriptor_DelayedPaymentOutput_get_delayed_payment_output(uint64_t ptr) {
1527         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1528         assert(obj->tag == LDKSpendableOutputDescriptor_DelayedPaymentOutput);
1529                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1530                         uint64_t delayed_payment_output_ref = 0;
1531                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
1532                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
1533         return delayed_payment_output_ref;
1534 }
1535 uint64_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output"))) TS_LDKSpendableOutputDescriptor_StaticPaymentOutput_get_static_payment_output(uint64_t ptr) {
1536         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
1537         assert(obj->tag == LDKSpendableOutputDescriptor_StaticPaymentOutput);
1538                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1539                         uint64_t static_payment_output_ref = 0;
1540                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
1541                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
1542         return static_payment_output_ref;
1543 }
1544 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1545 CHECK(owner->result_ok);
1546         return SpendableOutputDescriptor_clone(&*owner->contents.result);
1547 }
1548 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(uint64_t owner) {
1549         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1550         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
1551         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
1552         uint64_t ret_ref = tag_ptr(ret_copy, true);
1553         return ret_ref;
1554 }
1555
1556 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
1557 CHECK(!owner->result_ok);
1558         return DecodeError_clone(&*owner->contents.err);
1559 }
1560 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(uint64_t owner) {
1561         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
1562         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1563         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
1564         uint64_t ret_ref = tag_ptr(ret_copy, true);
1565         return ret_ref;
1566 }
1567
1568 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1569         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1570         for (size_t i = 0; i < ret.datalen; i++) {
1571                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1572         }
1573         return ret;
1574 }
1575 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
1576         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
1577         for (size_t i = 0; i < ret.datalen; i++) {
1578                 ret.data[i] = TxOut_clone(&orig->data[i]);
1579         }
1580         return ret;
1581 }
1582 uint32_t __attribute__((export_name("TS_LDKCOption_PackedLockTimeZ_ty_from_ptr"))) TS_LDKCOption_PackedLockTimeZ_ty_from_ptr(uint64_t ptr) {
1583         LDKCOption_PackedLockTimeZ *obj = (LDKCOption_PackedLockTimeZ*)untag_ptr(ptr);
1584         switch(obj->tag) {
1585                 case LDKCOption_PackedLockTimeZ_Some: return 0;
1586                 case LDKCOption_PackedLockTimeZ_None: return 1;
1587                 default: abort();
1588         }
1589 }
1590 int32_t __attribute__((export_name("TS_LDKCOption_PackedLockTimeZ_Some_get_some"))) TS_LDKCOption_PackedLockTimeZ_Some_get_some(uint64_t ptr) {
1591         LDKCOption_PackedLockTimeZ *obj = (LDKCOption_PackedLockTimeZ*)untag_ptr(ptr);
1592         assert(obj->tag == LDKCOption_PackedLockTimeZ_Some);
1593                         int32_t some_conv = obj->some;
1594         return some_conv;
1595 }
1596 static inline struct LDKCVec_u8Z C2Tuple_PartiallySignedTransactionusizeZ_get_a(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR owner){
1597         return CVec_u8Z_clone(&owner->a);
1598 }
1599 int8_tArray  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_get_a"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_get_a(uint64_t owner) {
1600         LDKC2Tuple_PartiallySignedTransactionusizeZ* owner_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(owner);
1601         LDKCVec_u8Z ret_var = C2Tuple_PartiallySignedTransactionusizeZ_get_a(owner_conv);
1602         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
1603         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
1604         CVec_u8Z_free(ret_var);
1605         return ret_arr;
1606 }
1607
1608 static inline uintptr_t C2Tuple_PartiallySignedTransactionusizeZ_get_b(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR owner){
1609         return owner->b;
1610 }
1611 uint32_t  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_get_b"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_get_b(uint64_t owner) {
1612         LDKC2Tuple_PartiallySignedTransactionusizeZ* owner_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(owner);
1613         uint32_t ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_get_b(owner_conv);
1614         return ret_conv;
1615 }
1616
1617 static inline struct LDKC2Tuple_PartiallySignedTransactionusizeZ CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR owner){
1618 CHECK(owner->result_ok);
1619         return C2Tuple_PartiallySignedTransactionusizeZ_clone(&*owner->contents.result);
1620 }
1621 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(uint64_t owner) {
1622         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(owner);
1623         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
1624         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_ok(owner_conv);
1625         return tag_ptr(ret_conv, true);
1626 }
1627
1628 static inline void CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR owner){
1629 CHECK(!owner->result_ok);
1630         return *owner->contents.err;
1631 }
1632 void  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(uint64_t owner) {
1633         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* owner_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(owner);
1634         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_get_err(owner_conv);
1635 }
1636
1637 static inline LDKCVec_PaymentPreimageZ CVec_PaymentPreimageZ_clone(const LDKCVec_PaymentPreimageZ *orig) {
1638         LDKCVec_PaymentPreimageZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_PaymentPreimageZ clone bytes"), .datalen = orig->datalen };
1639         for (size_t i = 0; i < ret.datalen; i++) {
1640                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1641         }
1642         return ret;
1643 }
1644 static inline struct LDKSignature C2Tuple_SignatureCVec_SignatureZZ_get_a(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1645         return owner->a;
1646 }
1647 int8_tArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_a"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_a(uint64_t owner) {
1648         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
1649         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1650         memcpy(ret_arr->elems, C2Tuple_SignatureCVec_SignatureZZ_get_a(owner_conv).compact_form, 64);
1651         return ret_arr;
1652 }
1653
1654 static inline struct LDKCVec_SignatureZ C2Tuple_SignatureCVec_SignatureZZ_get_b(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR owner){
1655         return owner->b;
1656 }
1657 ptrArray  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_get_b"))) TS_C2Tuple_SignatureCVec_SignatureZZ_get_b(uint64_t owner) {
1658         LDKC2Tuple_SignatureCVec_SignatureZZ* owner_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(owner);
1659         LDKCVec_SignatureZ ret_var = C2Tuple_SignatureCVec_SignatureZZ_get_b(owner_conv);
1660         ptrArray ret_arr = NULL;
1661         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
1662         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
1663         for (size_t m = 0; m < ret_var.datalen; m++) {
1664                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
1665                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
1666                 ret_arr_ptr[m] = ret_conv_12_arr;
1667         }
1668         
1669         return ret_arr;
1670 }
1671
1672 static inline struct LDKC2Tuple_SignatureCVec_SignatureZZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1673 CHECK(owner->result_ok);
1674         return C2Tuple_SignatureCVec_SignatureZZ_clone(&*owner->contents.result);
1675 }
1676 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(uint64_t owner) {
1677         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
1678         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1679         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_ok(owner_conv);
1680         return tag_ptr(ret_conv, true);
1681 }
1682
1683 static inline void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR owner){
1684 CHECK(!owner->result_ok);
1685         return *owner->contents.err;
1686 }
1687 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(uint64_t owner) {
1688         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(owner);
1689         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_err(owner_conv);
1690 }
1691
1692 static inline struct LDKSignature CResult_SignatureNoneZ_get_ok(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1693 CHECK(owner->result_ok);
1694         return *owner->contents.result;
1695 }
1696 int8_tArray  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_ok"))) TS_CResult_SignatureNoneZ_get_ok(uint64_t owner) {
1697         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
1698         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
1699         memcpy(ret_arr->elems, CResult_SignatureNoneZ_get_ok(owner_conv).compact_form, 64);
1700         return ret_arr;
1701 }
1702
1703 static inline void CResult_SignatureNoneZ_get_err(LDKCResult_SignatureNoneZ *NONNULL_PTR owner){
1704 CHECK(!owner->result_ok);
1705         return *owner->contents.err;
1706 }
1707 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResult_SignatureNoneZ_get_err(uint64_t owner) {
1708         LDKCResult_SignatureNoneZ* owner_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(owner);
1709         CResult_SignatureNoneZ_get_err(owner_conv);
1710 }
1711
1712 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1713 CHECK(owner->result_ok);
1714         return *owner->contents.result;
1715 }
1716 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_ok"))) TS_CResult_PublicKeyNoneZ_get_ok(uint64_t owner) {
1717         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1718         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1719         memcpy(ret_arr->elems, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form, 33);
1720         return ret_arr;
1721 }
1722
1723 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
1724 CHECK(!owner->result_ok);
1725         return *owner->contents.err;
1726 }
1727 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_get_err"))) TS_CResult_PublicKeyNoneZ_get_err(uint64_t owner) {
1728         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
1729         CResult_PublicKeyNoneZ_get_err(owner_conv);
1730 }
1731
1732 uint32_t __attribute__((export_name("TS_LDKCOption_ScalarZ_ty_from_ptr"))) TS_LDKCOption_ScalarZ_ty_from_ptr(uint64_t ptr) {
1733         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
1734         switch(obj->tag) {
1735                 case LDKCOption_ScalarZ_Some: return 0;
1736                 case LDKCOption_ScalarZ_None: return 1;
1737                 default: abort();
1738         }
1739 }
1740 uint64_t __attribute__((export_name("TS_LDKCOption_ScalarZ_Some_get_some"))) TS_LDKCOption_ScalarZ_Some_get_some(uint64_t ptr) {
1741         LDKCOption_ScalarZ *obj = (LDKCOption_ScalarZ*)untag_ptr(ptr);
1742         assert(obj->tag == LDKCOption_ScalarZ_Some);
1743                         LDKBigEndianScalar* some_ref = &obj->some;
1744         return tag_ptr(some_ref, false);
1745 }
1746 static inline struct LDKThirtyTwoBytes CResult_SharedSecretNoneZ_get_ok(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
1747 CHECK(owner->result_ok);
1748         return ThirtyTwoBytes_clone(&*owner->contents.result);
1749 }
1750 int8_tArray  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_ok"))) TS_CResult_SharedSecretNoneZ_get_ok(uint64_t owner) {
1751         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
1752         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1753         memcpy(ret_arr->elems, CResult_SharedSecretNoneZ_get_ok(owner_conv).data, 32);
1754         return ret_arr;
1755 }
1756
1757 static inline void CResult_SharedSecretNoneZ_get_err(LDKCResult_SharedSecretNoneZ *NONNULL_PTR owner){
1758 CHECK(!owner->result_ok);
1759         return *owner->contents.err;
1760 }
1761 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CResult_SharedSecretNoneZ_get_err(uint64_t owner) {
1762         LDKCResult_SharedSecretNoneZ* owner_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(owner);
1763         CResult_SharedSecretNoneZ_get_err(owner_conv);
1764 }
1765
1766 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1767 CHECK(owner->result_ok);
1768         return *owner->contents.result;
1769 }
1770 int8_tArray  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) {
1771         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1772         int8_tArray ret_arr = init_int8_tArray(68, __LINE__);
1773         memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68);
1774         return ret_arr;
1775 }
1776
1777 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
1778 CHECK(!owner->result_ok);
1779         return *owner->contents.err;
1780 }
1781 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) {
1782         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
1783         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
1784 }
1785
1786 typedef struct LDKChannelSigner_JCalls {
1787         atomic_size_t refcnt;
1788         uint32_t instance_ptr;
1789 } LDKChannelSigner_JCalls;
1790 static void LDKChannelSigner_JCalls_free(void* this_arg) {
1791         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1792         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1793                 FREE(j_calls);
1794         }
1795 }
1796 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1797         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1798         int64_t idx_conv = idx;
1799         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 0, idx_conv, 0, 0, 0, 0, 0);
1800         LDKPublicKey ret_ref;
1801         CHECK(ret->arr_len == 33);
1802         memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret);
1803         return ret_ref;
1804 }
1805 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
1806         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1807         int64_t idx_conv = idx;
1808         int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 1, idx_conv, 0, 0, 0, 0, 0);
1809         LDKThirtyTwoBytes ret_ref;
1810         CHECK(ret->arr_len == 32);
1811         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1812         return ret_ref;
1813 }
1814 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) {
1815         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1816         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
1817         uint64_t holder_tx_ref = 0;
1818         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
1819         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
1820         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
1821         LDKCVec_PaymentPreimageZ preimages_var = preimages;
1822         ptrArray preimages_arr = NULL;
1823         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1824         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1825         for (size_t m = 0; m < preimages_var.datalen; m++) {
1826                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1827                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1828                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1829         }
1830         
1831         FREE(preimages_var.data);
1832         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 2, holder_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
1833         void* ret_ptr = untag_ptr(ret);
1834         CHECK_ACCESS(ret_ptr);
1835         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
1836         FREE(untag_ptr(ret));
1837         return ret_conv;
1838 }
1839 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
1840         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1841         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 3, 0, 0, 0, 0, 0, 0);
1842         LDKThirtyTwoBytes ret_ref;
1843         CHECK(ret->arr_len == 32);
1844         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
1845         return ret_ref;
1846 }
1847 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1848         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
1849         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1850         uint64_t channel_parameters_ref = 0;
1851         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
1852         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
1853         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
1854         js_invoke_function_buuuuu(j_calls->instance_ptr, 4, channel_parameters_ref, 0, 0, 0, 0, 0);
1855 }
1856 static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) {
1857         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg;
1858         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1859 }
1860 static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) {
1861         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
1862         atomic_init(&calls->refcnt, 1);
1863         calls->instance_ptr = o;
1864
1865         LDKChannelPublicKeys pubkeys_conv;
1866         pubkeys_conv.inner = untag_ptr(pubkeys);
1867         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
1868         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
1869
1870         LDKChannelSigner ret = {
1871                 .this_arg = (void*) calls,
1872                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
1873                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
1874                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
1875                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
1876                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
1877                 .free = LDKChannelSigner_JCalls_free,
1878                 .pubkeys = pubkeys_conv,
1879                 .set_pubkeys = NULL,
1880         };
1881         return ret;
1882 }
1883 uint64_t  __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) {
1884         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
1885         *res_ptr = LDKChannelSigner_init(o, pubkeys);
1886         return tag_ptr(res_ptr, true);
1887 }
1888 int8_tArray  __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) {
1889         void* this_arg_ptr = untag_ptr(this_arg);
1890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1891         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1892         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
1893         memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33);
1894         return ret_arr;
1895 }
1896
1897 int8_tArray  __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) {
1898         void* this_arg_ptr = untag_ptr(this_arg);
1899         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1900         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1901         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1902         memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32);
1903         return ret_arr;
1904 }
1905
1906 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) {
1907         void* this_arg_ptr = untag_ptr(this_arg);
1908         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1909         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1910         LDKHolderCommitmentTransaction holder_tx_conv;
1911         holder_tx_conv.inner = untag_ptr(holder_tx);
1912         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
1913         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
1914         holder_tx_conv.is_owned = false;
1915         LDKCVec_PaymentPreimageZ preimages_constr;
1916         preimages_constr.datalen = preimages->arr_len;
1917         if (preimages_constr.datalen > 0)
1918                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
1919         else
1920                 preimages_constr.data = NULL;
1921         int8_tArray* preimages_vals = (void*) preimages->elems;
1922         for (size_t m = 0; m < preimages_constr.datalen; m++) {
1923                 int8_tArray preimages_conv_12 = preimages_vals[m];
1924                 LDKThirtyTwoBytes preimages_conv_12_ref;
1925                 CHECK(preimages_conv_12->arr_len == 32);
1926                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
1927                 preimages_constr.data[m] = preimages_conv_12_ref;
1928         }
1929         FREE(preimages);
1930         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
1931         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr);
1932         return tag_ptr(ret_conv, true);
1933 }
1934
1935 int8_tArray  __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) {
1936         void* this_arg_ptr = untag_ptr(this_arg);
1937         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1938         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1939         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
1940         memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32);
1941         return ret_arr;
1942 }
1943
1944 void  __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) {
1945         void* this_arg_ptr = untag_ptr(this_arg);
1946         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1947         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1948         LDKChannelTransactionParameters channel_parameters_conv;
1949         channel_parameters_conv.inner = untag_ptr(channel_parameters);
1950         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
1951         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
1952         channel_parameters_conv.is_owned = false;
1953         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
1954 }
1955
1956 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
1957         if (this_arg->set_pubkeys != NULL)
1958                 this_arg->set_pubkeys(this_arg);
1959         return this_arg->pubkeys;
1960 }
1961 uint64_t  __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) {
1962         void* this_arg_ptr = untag_ptr(this_arg);
1963         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
1964         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
1965         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
1966         uint64_t ret_ref = 0;
1967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1969         return ret_ref;
1970 }
1971
1972 typedef struct LDKEcdsaChannelSigner_JCalls {
1973         atomic_size_t refcnt;
1974         uint32_t instance_ptr;
1975         LDKChannelSigner_JCalls* ChannelSigner;
1976 } LDKEcdsaChannelSigner_JCalls;
1977 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
1978         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1979         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1980                 FREE(j_calls);
1981         }
1982 }
1983 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) {
1984         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
1985         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1986         uint64_t commitment_tx_ref = 0;
1987         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
1988         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
1989         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
1990         LDKCVec_PaymentPreimageZ preimages_var = preimages;
1991         ptrArray preimages_arr = NULL;
1992         preimages_arr = init_ptrArray(preimages_var.datalen, __LINE__);
1993         int8_tArray *preimages_arr_ptr = (int8_tArray*)(((uint8_t*)preimages_arr) + 8);
1994         for (size_t m = 0; m < preimages_var.datalen; m++) {
1995                 int8_tArray preimages_conv_12_arr = init_int8_tArray(32, __LINE__);
1996                 memcpy(preimages_conv_12_arr->elems, preimages_var.data[m].data, 32);
1997                 preimages_arr_ptr[m] = preimages_conv_12_arr;
1998         }
1999         
2000         FREE(preimages_var.data);
2001         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 5, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0);
2002         void* ret_ptr = untag_ptr(ret);
2003         CHECK_ACCESS(ret_ptr);
2004         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2005         FREE(untag_ptr(ret));
2006         return ret_conv;
2007 }
2008 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
2009         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2010         int64_t idx_conv = idx;
2011         int8_tArray secret_arr = init_int8_tArray(32, __LINE__);
2012         memcpy(secret_arr->elems, *secret, 32);
2013         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0);
2014         void* ret_ptr = untag_ptr(ret);
2015         CHECK_ACCESS(ret_ptr);
2016         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
2017         FREE(untag_ptr(ret));
2018         return ret_conv;
2019 }
2020 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2021         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2022         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2023         uint64_t commitment_tx_ref = 0;
2024         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
2025         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
2026         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
2027         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, 0, 0, 0, 0, 0);
2028         void* ret_ptr = untag_ptr(ret);
2029         CHECK_ACCESS(ret_ptr);
2030         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr);
2031         FREE(untag_ptr(ret));
2032         return ret_conv;
2033 }
2034 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
2035         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2036         LDKTransaction justice_tx_var = justice_tx;
2037         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
2038         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2039         Transaction_free(justice_tx_var);
2040         uint32_t input_conv = input;
2041         int64_t amount_conv = amount;
2042         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
2043         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2044         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);
2045         void* ret_ptr = untag_ptr(ret);
2046         CHECK_ACCESS(ret_ptr);
2047         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2048         FREE(untag_ptr(ret));
2049         return ret_conv;
2050 }
2051 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2052         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2053         LDKTransaction justice_tx_var = justice_tx;
2054         int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__);
2055         memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen);
2056         Transaction_free(justice_tx_var);
2057         uint32_t input_conv = input;
2058         int64_t amount_conv = amount;
2059         int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__);
2060         memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32);
2061         LDKHTLCOutputInCommitment htlc_var = *htlc;
2062         uint64_t htlc_ref = 0;
2063         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2064         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2065         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2066         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);
2067         void* ret_ptr = untag_ptr(ret);
2068         CHECK_ACCESS(ret_ptr);
2069         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2070         FREE(untag_ptr(ret));
2071         return ret_conv;
2072 }
2073 LDKCResult_SignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
2074         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2075         LDKTransaction htlc_tx_var = htlc_tx;
2076         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2077         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2078         Transaction_free(htlc_tx_var);
2079         uint32_t input_conv = input;
2080         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
2081         uint64_t htlc_descriptor_ref = 0;
2082         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
2083         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
2084         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
2085         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);
2086         void* ret_ptr = untag_ptr(ret);
2087         CHECK_ACCESS(ret_ptr);
2088         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2089         FREE(untag_ptr(ret));
2090         return ret_conv;
2091 }
2092 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2093         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2094         LDKTransaction htlc_tx_var = htlc_tx;
2095         int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__);
2096         memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen);
2097         Transaction_free(htlc_tx_var);
2098         uint32_t input_conv = input;
2099         int64_t amount_conv = amount;
2100         int8_tArray per_commitment_point_arr = init_int8_tArray(33, __LINE__);
2101         memcpy(per_commitment_point_arr->elems, per_commitment_point.compressed_form, 33);
2102         LDKHTLCOutputInCommitment htlc_var = *htlc;
2103         uint64_t htlc_ref = 0;
2104         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
2105         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
2106         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
2107         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);
2108         void* ret_ptr = untag_ptr(ret);
2109         CHECK_ACCESS(ret_ptr);
2110         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2111         FREE(untag_ptr(ret));
2112         return ret_conv;
2113 }
2114 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
2115         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2116         LDKClosingTransaction closing_tx_var = *closing_tx;
2117         uint64_t closing_tx_ref = 0;
2118         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
2119         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
2120         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
2121         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0);
2122         void* ret_ptr = untag_ptr(ret);
2123         CHECK_ACCESS(ret_ptr);
2124         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2125         FREE(untag_ptr(ret));
2126         return ret_conv;
2127 }
2128 LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
2129         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2130         LDKTransaction anchor_tx_var = anchor_tx;
2131         int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__);
2132         memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen);
2133         Transaction_free(anchor_tx_var);
2134         uint32_t input_conv = input;
2135         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0);
2136         void* ret_ptr = untag_ptr(ret);
2137         CHECK_ACCESS(ret_ptr);
2138         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2139         FREE(untag_ptr(ret));
2140         return ret_conv;
2141 }
2142 LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2143         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
2144         LDKUnsignedChannelAnnouncement msg_var = *msg;
2145         uint64_t msg_ref = 0;
2146         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
2147         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
2148         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
2149         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 14, msg_ref, 0, 0, 0, 0, 0);
2150         void* ret_ptr = untag_ptr(ret);
2151         CHECK_ACCESS(ret_ptr);
2152         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
2153         FREE(untag_ptr(ret));
2154         return ret_conv;
2155 }
2156 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
2157         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2158         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2159         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
2160 }
2161 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2162         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
2163         atomic_init(&calls->refcnt, 1);
2164         calls->instance_ptr = o;
2165
2166         LDKChannelPublicKeys pubkeys_conv;
2167         pubkeys_conv.inner = untag_ptr(pubkeys);
2168         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2169         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2170
2171         LDKEcdsaChannelSigner ret = {
2172                 .this_arg = (void*) calls,
2173                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
2174                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall,
2175                 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall,
2176                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
2177                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
2178                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2179                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
2180                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
2181                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
2182                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
2183                 .free = LDKEcdsaChannelSigner_JCalls_free,
2184                 .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys),
2185         };
2186         calls->ChannelSigner = ret.ChannelSigner.this_arg;
2187         return ret;
2188 }
2189 uint64_t  __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) {
2190         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
2191         *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys);
2192         return tag_ptr(res_ptr, true);
2193 }
2194 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) {
2195         void* this_arg_ptr = untag_ptr(this_arg);
2196         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2197         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2198         LDKCommitmentTransaction commitment_tx_conv;
2199         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2200         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2201         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2202         commitment_tx_conv.is_owned = false;
2203         LDKCVec_PaymentPreimageZ preimages_constr;
2204         preimages_constr.datalen = preimages->arr_len;
2205         if (preimages_constr.datalen > 0)
2206                 preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
2207         else
2208                 preimages_constr.data = NULL;
2209         int8_tArray* preimages_vals = (void*) preimages->elems;
2210         for (size_t m = 0; m < preimages_constr.datalen; m++) {
2211                 int8_tArray preimages_conv_12 = preimages_vals[m];
2212                 LDKThirtyTwoBytes preimages_conv_12_ref;
2213                 CHECK(preimages_conv_12->arr_len == 32);
2214                 memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12);
2215                 preimages_constr.data[m] = preimages_conv_12_ref;
2216         }
2217         FREE(preimages);
2218         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2219         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, preimages_constr);
2220         return tag_ptr(ret_conv, true);
2221 }
2222
2223 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) {
2224         void* this_arg_ptr = untag_ptr(this_arg);
2225         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2226         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2227         uint8_t secret_arr[32];
2228         CHECK(secret->arr_len == 32);
2229         memcpy(secret_arr, secret->elems, 32); FREE(secret);
2230         uint8_t (*secret_ref)[32] = &secret_arr;
2231         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
2232         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
2233         return tag_ptr(ret_conv, true);
2234 }
2235
2236 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) {
2237         void* this_arg_ptr = untag_ptr(this_arg);
2238         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2239         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2240         LDKHolderCommitmentTransaction commitment_tx_conv;
2241         commitment_tx_conv.inner = untag_ptr(commitment_tx);
2242         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
2243         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
2244         commitment_tx_conv.is_owned = false;
2245         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2246         *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2247         return tag_ptr(ret_conv, true);
2248 }
2249
2250 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) {
2251         void* this_arg_ptr = untag_ptr(this_arg);
2252         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2253         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2254         LDKTransaction justice_tx_ref;
2255         justice_tx_ref.datalen = justice_tx->arr_len;
2256         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2257         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2258         justice_tx_ref.data_is_owned = true;
2259         uint8_t per_commitment_key_arr[32];
2260         CHECK(per_commitment_key->arr_len == 32);
2261         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2262         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2263         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2264         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2265         return tag_ptr(ret_conv, true);
2266 }
2267
2268 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) {
2269         void* this_arg_ptr = untag_ptr(this_arg);
2270         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2271         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2272         LDKTransaction justice_tx_ref;
2273         justice_tx_ref.datalen = justice_tx->arr_len;
2274         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2275         memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx);
2276         justice_tx_ref.data_is_owned = true;
2277         uint8_t per_commitment_key_arr[32];
2278         CHECK(per_commitment_key->arr_len == 32);
2279         memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key);
2280         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2281         LDKHTLCOutputInCommitment htlc_conv;
2282         htlc_conv.inner = untag_ptr(htlc);
2283         htlc_conv.is_owned = ptr_is_owned(htlc);
2284         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2285         htlc_conv.is_owned = false;
2286         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2287         *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);
2288         return tag_ptr(ret_conv, true);
2289 }
2290
2291 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) {
2292         void* this_arg_ptr = untag_ptr(this_arg);
2293         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2294         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2295         LDKTransaction htlc_tx_ref;
2296         htlc_tx_ref.datalen = htlc_tx->arr_len;
2297         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2298         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2299         htlc_tx_ref.data_is_owned = true;
2300         LDKHTLCDescriptor htlc_descriptor_conv;
2301         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
2302         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
2303         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
2304         htlc_descriptor_conv.is_owned = false;
2305         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2306         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
2307         return tag_ptr(ret_conv, true);
2308 }
2309
2310 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) {
2311         void* this_arg_ptr = untag_ptr(this_arg);
2312         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2313         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2314         LDKTransaction htlc_tx_ref;
2315         htlc_tx_ref.datalen = htlc_tx->arr_len;
2316         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2317         memcpy(htlc_tx_ref.data, htlc_tx->elems, htlc_tx_ref.datalen); FREE(htlc_tx);
2318         htlc_tx_ref.data_is_owned = true;
2319         LDKPublicKey per_commitment_point_ref;
2320         CHECK(per_commitment_point->arr_len == 33);
2321         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
2322         LDKHTLCOutputInCommitment htlc_conv;
2323         htlc_conv.inner = untag_ptr(htlc);
2324         htlc_conv.is_owned = ptr_is_owned(htlc);
2325         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
2326         htlc_conv.is_owned = false;
2327         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2328         *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);
2329         return tag_ptr(ret_conv, true);
2330 }
2331
2332 uint64_t  __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) {
2333         void* this_arg_ptr = untag_ptr(this_arg);
2334         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2335         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2336         LDKClosingTransaction closing_tx_conv;
2337         closing_tx_conv.inner = untag_ptr(closing_tx);
2338         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
2339         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
2340         closing_tx_conv.is_owned = false;
2341         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2342         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
2343         return tag_ptr(ret_conv, true);
2344 }
2345
2346 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) {
2347         void* this_arg_ptr = untag_ptr(this_arg);
2348         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2349         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2350         LDKTransaction anchor_tx_ref;
2351         anchor_tx_ref.datalen = anchor_tx->arr_len;
2352         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
2353         memcpy(anchor_tx_ref.data, anchor_tx->elems, anchor_tx_ref.datalen); FREE(anchor_tx);
2354         anchor_tx_ref.data_is_owned = true;
2355         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2356         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
2357         return tag_ptr(ret_conv, true);
2358 }
2359
2360 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) {
2361         void* this_arg_ptr = untag_ptr(this_arg);
2362         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2363         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
2364         LDKUnsignedChannelAnnouncement msg_conv;
2365         msg_conv.inner = untag_ptr(msg);
2366         msg_conv.is_owned = ptr_is_owned(msg);
2367         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
2368         msg_conv.is_owned = false;
2369         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2370         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
2371         return tag_ptr(ret_conv, true);
2372 }
2373
2374 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
2375         atomic_size_t refcnt;
2376         uint32_t instance_ptr;
2377         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
2378         LDKChannelSigner_JCalls* ChannelSigner;
2379 } LDKWriteableEcdsaChannelSigner_JCalls;
2380 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
2381         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2382         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2383                 FREE(j_calls);
2384         }
2385 }
2386 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
2387         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
2388         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 15, 0, 0, 0, 0, 0, 0);
2389         LDKCVec_u8Z ret_ref;
2390         ret_ref.datalen = ret->arr_len;
2391         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2392         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
2393         return ret_ref;
2394 }
2395 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
2396         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
2397         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2398         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
2399         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
2400 }
2401 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2402         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
2403         atomic_init(&calls->refcnt, 1);
2404         calls->instance_ptr = o;
2405
2406         LDKChannelPublicKeys pubkeys_conv;
2407         pubkeys_conv.inner = untag_ptr(pubkeys);
2408         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
2409         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
2410
2411         LDKWriteableEcdsaChannelSigner ret = {
2412                 .this_arg = (void*) calls,
2413                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
2414                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
2415                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
2416                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys),
2417         };
2418         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
2419         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
2420         return ret;
2421 }
2422 uint64_t  __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) {
2423         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2424         *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys);
2425         return tag_ptr(res_ptr, true);
2426 }
2427 int8_tArray  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) {
2428         void* this_arg_ptr = untag_ptr(this_arg);
2429         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
2430         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
2431         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2432         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2433         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2434         CVec_u8Z_free(ret_var);
2435         return ret_arr;
2436 }
2437
2438 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2439 CHECK(owner->result_ok);
2440         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
2441 }
2442 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) {
2443         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2444         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
2445         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
2446         return tag_ptr(ret_ret, true);
2447 }
2448
2449 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
2450 CHECK(!owner->result_ok);
2451         return DecodeError_clone(&*owner->contents.err);
2452 }
2453 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) {
2454         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
2455         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2456         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
2457         uint64_t ret_ref = tag_ptr(ret_copy, true);
2458         return ret_ref;
2459 }
2460
2461 static inline struct LDKCVec_u8Z CResult_ScriptNoneZ_get_ok(LDKCResult_ScriptNoneZ *NONNULL_PTR owner){
2462 CHECK(owner->result_ok);
2463         return CVec_u8Z_clone(&*owner->contents.result);
2464 }
2465 int8_tArray  __attribute__((export_name("TS_CResult_ScriptNoneZ_get_ok"))) TS_CResult_ScriptNoneZ_get_ok(uint64_t owner) {
2466         LDKCResult_ScriptNoneZ* owner_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(owner);
2467         LDKCVec_u8Z ret_var = CResult_ScriptNoneZ_get_ok(owner_conv);
2468         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2469         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2470         CVec_u8Z_free(ret_var);
2471         return ret_arr;
2472 }
2473
2474 static inline void CResult_ScriptNoneZ_get_err(LDKCResult_ScriptNoneZ *NONNULL_PTR owner){
2475 CHECK(!owner->result_ok);
2476         return *owner->contents.err;
2477 }
2478 void  __attribute__((export_name("TS_CResult_ScriptNoneZ_get_err"))) TS_CResult_ScriptNoneZ_get_err(uint64_t owner) {
2479         LDKCResult_ScriptNoneZ* owner_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(owner);
2480         CResult_ScriptNoneZ_get_err(owner_conv);
2481 }
2482
2483 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2484         LDKShutdownScript ret = *owner->contents.result;
2485         ret.is_owned = false;
2486         return ret;
2487 }
2488 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_ok"))) TS_CResult_ShutdownScriptNoneZ_get_ok(uint64_t owner) {
2489         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2490         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
2491         uint64_t ret_ref = 0;
2492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2494         return ret_ref;
2495 }
2496
2497 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
2498 CHECK(!owner->result_ok);
2499         return *owner->contents.err;
2500 }
2501 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_get_err"))) TS_CResult_ShutdownScriptNoneZ_get_err(uint64_t owner) {
2502         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
2503         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
2504 }
2505
2506 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2507         LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2508         for (size_t i = 0; i < ret.datalen; i++) {
2509                 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2510         }
2511         return ret;
2512 }
2513 static inline struct LDKCVec_CVec_u8ZZ CResult_CVec_CVec_u8ZZNoneZ_get_ok(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2514 CHECK(owner->result_ok);
2515         return CVec_CVec_u8ZZ_clone(&*owner->contents.result);
2516 }
2517 ptrArray  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_ok(uint64_t owner) {
2518         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2519         LDKCVec_CVec_u8ZZ ret_var = CResult_CVec_CVec_u8ZZNoneZ_get_ok(owner_conv);
2520         ptrArray ret_arr = NULL;
2521         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
2522         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
2523         for (size_t m = 0; m < ret_var.datalen; m++) {
2524                 LDKCVec_u8Z ret_conv_12_var = ret_var.data[m];
2525                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
2526                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
2527                 CVec_u8Z_free(ret_conv_12_var);
2528                 ret_arr_ptr[m] = ret_conv_12_arr;
2529         }
2530         
2531         FREE(ret_var.data);
2532         return ret_arr;
2533 }
2534
2535 static inline void CResult_CVec_CVec_u8ZZNoneZ_get_err(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR owner){
2536 CHECK(!owner->result_ok);
2537         return *owner->contents.err;
2538 }
2539 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_get_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_get_err(uint64_t owner) {
2540         LDKCResult_CVec_CVec_u8ZZNoneZ* owner_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(owner);
2541         CResult_CVec_CVec_u8ZZNoneZ_get_err(owner_conv);
2542 }
2543
2544 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2545         LDKInMemorySigner ret = *owner->contents.result;
2546         ret.is_owned = false;
2547         return ret;
2548 }
2549 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_get_ok(uint64_t owner) {
2550         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2551         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
2552         uint64_t ret_ref = 0;
2553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2555         return ret_ref;
2556 }
2557
2558 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
2559 CHECK(!owner->result_ok);
2560         return DecodeError_clone(&*owner->contents.err);
2561 }
2562 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_get_err"))) TS_CResult_InMemorySignerDecodeErrorZ_get_err(uint64_t owner) {
2563         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
2564         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2565         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
2566         uint64_t ret_ref = tag_ptr(ret_copy, true);
2567         return ret_ref;
2568 }
2569
2570 static inline struct LDKCVec_u8Z CResult_PartiallySignedTransactionNoneZ_get_ok(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR owner){
2571 CHECK(owner->result_ok);
2572         return CVec_u8Z_clone(&*owner->contents.result);
2573 }
2574 int8_tArray  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_get_ok"))) TS_CResult_PartiallySignedTransactionNoneZ_get_ok(uint64_t owner) {
2575         LDKCResult_PartiallySignedTransactionNoneZ* owner_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(owner);
2576         LDKCVec_u8Z ret_var = CResult_PartiallySignedTransactionNoneZ_get_ok(owner_conv);
2577         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2578         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2579         CVec_u8Z_free(ret_var);
2580         return ret_arr;
2581 }
2582
2583 static inline void CResult_PartiallySignedTransactionNoneZ_get_err(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR owner){
2584 CHECK(!owner->result_ok);
2585         return *owner->contents.err;
2586 }
2587 void  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_get_err"))) TS_CResult_PartiallySignedTransactionNoneZ_get_err(uint64_t owner) {
2588         LDKCResult_PartiallySignedTransactionNoneZ* owner_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(owner);
2589         CResult_PartiallySignedTransactionNoneZ_get_err(owner_conv);
2590 }
2591
2592 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2593 CHECK(owner->result_ok);
2594         return *owner->contents.result;
2595 }
2596 int8_tArray  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_ok"))) TS_CResult_TransactionNoneZ_get_ok(uint64_t owner) {
2597         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2598         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2599         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2600         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2601         return ret_arr;
2602 }
2603
2604 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2605 CHECK(!owner->result_ok);
2606         return *owner->contents.err;
2607 }
2608 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_get_err"))) TS_CResult_TransactionNoneZ_get_err(uint64_t owner) {
2609         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2610         CResult_TransactionNoneZ_get_err(owner_conv);
2611 }
2612
2613 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2614         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2615         for (size_t i = 0; i < ret.datalen; i++) {
2616                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2617         }
2618         return ret;
2619 }
2620 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2621         LDKRoute ret = *owner->contents.result;
2622         ret.is_owned = false;
2623         return ret;
2624 }
2625 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) {
2626         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2627         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
2628         uint64_t ret_ref = 0;
2629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2631         return ret_ref;
2632 }
2633
2634 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
2635         LDKLightningError ret = *owner->contents.err;
2636         ret.is_owned = false;
2637         return ret;
2638 }
2639 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) {
2640         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
2641         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
2642         uint64_t ret_ref = 0;
2643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2645         return ret_ref;
2646 }
2647
2648 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2649         LDKInFlightHtlcs ret = *owner->contents.result;
2650         ret.is_owned = false;
2651         return ret;
2652 }
2653 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) {
2654         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2655         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
2656         uint64_t ret_ref = 0;
2657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2659         return ret_ref;
2660 }
2661
2662 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
2663 CHECK(!owner->result_ok);
2664         return DecodeError_clone(&*owner->contents.err);
2665 }
2666 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) {
2667         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
2668         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2669         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
2670         uint64_t ret_ref = tag_ptr(ret_copy, true);
2671         return ret_ref;
2672 }
2673
2674 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2675         LDKRouteHop ret = *owner->contents.result;
2676         ret.is_owned = false;
2677         return ret;
2678 }
2679 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHopDecodeErrorZ_get_ok(uint64_t owner) {
2680         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2681         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
2682         uint64_t ret_ref = 0;
2683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2685         return ret_ref;
2686 }
2687
2688 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
2689 CHECK(!owner->result_ok);
2690         return DecodeError_clone(&*owner->contents.err);
2691 }
2692 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err"))) TS_CResult_RouteHopDecodeErrorZ_get_err(uint64_t owner) {
2693         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
2694         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2695         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
2696         uint64_t ret_ref = tag_ptr(ret_copy, true);
2697         return ret_ref;
2698 }
2699
2700 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
2701         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
2702         for (size_t i = 0; i < ret.datalen; i++) {
2703                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
2704         }
2705         return ret;
2706 }
2707 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2708         LDKBlindedTail ret = *owner->contents.result;
2709         ret.is_owned = false;
2710         return ret;
2711 }
2712 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_ok"))) TS_CResult_BlindedTailDecodeErrorZ_get_ok(uint64_t owner) {
2713         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2714         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
2715         uint64_t ret_ref = 0;
2716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2718         return ret_ref;
2719 }
2720
2721 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
2722 CHECK(!owner->result_ok);
2723         return DecodeError_clone(&*owner->contents.err);
2724 }
2725 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_get_err"))) TS_CResult_BlindedTailDecodeErrorZ_get_err(uint64_t owner) {
2726         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
2727         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2728         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
2729         uint64_t ret_ref = tag_ptr(ret_copy, true);
2730         return ret_ref;
2731 }
2732
2733 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
2734         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
2735         for (size_t i = 0; i < ret.datalen; i++) {
2736                 ret.data[i] = RouteHop_clone(&orig->data[i]);
2737         }
2738         return ret;
2739 }
2740 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
2741         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
2742         for (size_t i = 0; i < ret.datalen; i++) {
2743                 ret.data[i] = Path_clone(&orig->data[i]);
2744         }
2745         return ret;
2746 }
2747 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2748         LDKRoute ret = *owner->contents.result;
2749         ret.is_owned = false;
2750         return ret;
2751 }
2752 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_ok"))) TS_CResult_RouteDecodeErrorZ_get_ok(uint64_t owner) {
2753         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2754         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
2755         uint64_t ret_ref = 0;
2756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2758         return ret_ref;
2759 }
2760
2761 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
2762 CHECK(!owner->result_ok);
2763         return DecodeError_clone(&*owner->contents.err);
2764 }
2765 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_get_err"))) TS_CResult_RouteDecodeErrorZ_get_err(uint64_t owner) {
2766         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
2767         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2768         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
2769         uint64_t ret_ref = tag_ptr(ret_copy, true);
2770         return ret_ref;
2771 }
2772
2773 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2774         LDKRouteParameters ret = *owner->contents.result;
2775         ret.is_owned = false;
2776         return ret;
2777 }
2778 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_ok"))) TS_CResult_RouteParametersDecodeErrorZ_get_ok(uint64_t owner) {
2779         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2780         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
2781         uint64_t ret_ref = 0;
2782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2784         return ret_ref;
2785 }
2786
2787 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
2788 CHECK(!owner->result_ok);
2789         return DecodeError_clone(&*owner->contents.err);
2790 }
2791 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_get_err"))) TS_CResult_RouteParametersDecodeErrorZ_get_err(uint64_t owner) {
2792         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
2793         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2794         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
2795         uint64_t ret_ref = tag_ptr(ret_copy, true);
2796         return ret_ref;
2797 }
2798
2799 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2800         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2801         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2802         return ret;
2803 }
2804 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2805         LDKPaymentParameters ret = *owner->contents.result;
2806         ret.is_owned = false;
2807         return ret;
2808 }
2809 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_get_ok(uint64_t owner) {
2810         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2811         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
2812         uint64_t ret_ref = 0;
2813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2815         return ret_ref;
2816 }
2817
2818 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
2819 CHECK(!owner->result_ok);
2820         return DecodeError_clone(&*owner->contents.err);
2821 }
2822 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_get_err"))) TS_CResult_PaymentParametersDecodeErrorZ_get_err(uint64_t owner) {
2823         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
2824         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2825         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
2826         uint64_t ret_ref = tag_ptr(ret_copy, true);
2827         return ret_ref;
2828 }
2829
2830 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2831         LDKBlindedPayInfo ret = owner->a;
2832         ret.is_owned = false;
2833         return ret;
2834 }
2835 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_a(uint64_t owner) {
2836         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2837         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
2838         uint64_t ret_ref = 0;
2839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2841         return ret_ref;
2842 }
2843
2844 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
2845         LDKBlindedPath ret = owner->b;
2846         ret.is_owned = false;
2847         return ret;
2848 }
2849 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_get_b(uint64_t owner) {
2850         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
2851         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
2852         uint64_t ret_ref = 0;
2853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2855         return ret_ref;
2856 }
2857
2858 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
2859         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
2860         for (size_t i = 0; i < ret.datalen; i++) {
2861                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
2862         }
2863         return ret;
2864 }
2865 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
2866         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
2867         for (size_t i = 0; i < ret.datalen; i++) {
2868                 ret.data[i] = RouteHint_clone(&orig->data[i]);
2869         }
2870         return ret;
2871 }
2872 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
2873         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
2874         for (size_t i = 0; i < ret.datalen; i++) {
2875                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
2876         }
2877         return ret;
2878 }
2879 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2880         LDKRouteHint ret = *owner->contents.result;
2881         ret.is_owned = false;
2882         return ret;
2883 }
2884 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_ok"))) TS_CResult_RouteHintDecodeErrorZ_get_ok(uint64_t owner) {
2885         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2886         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
2887         uint64_t ret_ref = 0;
2888         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2889         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2890         return ret_ref;
2891 }
2892
2893 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
2894 CHECK(!owner->result_ok);
2895         return DecodeError_clone(&*owner->contents.err);
2896 }
2897 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_get_err"))) TS_CResult_RouteHintDecodeErrorZ_get_err(uint64_t owner) {
2898         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
2899         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2900         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
2901         uint64_t ret_ref = tag_ptr(ret_copy, true);
2902         return ret_ref;
2903 }
2904
2905 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2906         LDKRouteHintHop ret = *owner->contents.result;
2907         ret.is_owned = false;
2908         return ret;
2909 }
2910 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_get_ok(uint64_t owner) {
2911         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2912         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
2913         uint64_t ret_ref = 0;
2914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2916         return ret_ref;
2917 }
2918
2919 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
2920 CHECK(!owner->result_ok);
2921         return DecodeError_clone(&*owner->contents.err);
2922 }
2923 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_err"))) TS_CResult_RouteHintHopDecodeErrorZ_get_err(uint64_t owner) {
2924         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
2925         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2926         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
2927         uint64_t ret_ref = tag_ptr(ret_copy, true);
2928         return ret_ref;
2929 }
2930
2931 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2932         return owner->a;
2933 }
2934 uint32_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_a"))) TS_C2Tuple_usizeTransactionZ_get_a(uint64_t owner) {
2935         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2936         uint32_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
2937         return ret_conv;
2938 }
2939
2940 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
2941         return owner->b;
2942 }
2943 int8_tArray  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_get_b"))) TS_C2Tuple_usizeTransactionZ_get_b(uint64_t owner) {
2944         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
2945         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
2946         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
2947         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
2948         return ret_arr;
2949 }
2950
2951 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
2952         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
2953         for (size_t i = 0; i < ret.datalen; i++) {
2954                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
2955         }
2956         return ret;
2957 }
2958 uint32_t __attribute__((export_name("TS_LDKCOption_BlockHashZ_ty_from_ptr"))) TS_LDKCOption_BlockHashZ_ty_from_ptr(uint64_t ptr) {
2959         LDKCOption_BlockHashZ *obj = (LDKCOption_BlockHashZ*)untag_ptr(ptr);
2960         switch(obj->tag) {
2961                 case LDKCOption_BlockHashZ_Some: return 0;
2962                 case LDKCOption_BlockHashZ_None: return 1;
2963                 default: abort();
2964         }
2965 }
2966 int8_tArray __attribute__((export_name("TS_LDKCOption_BlockHashZ_Some_get_some"))) TS_LDKCOption_BlockHashZ_Some_get_some(uint64_t ptr) {
2967         LDKCOption_BlockHashZ *obj = (LDKCOption_BlockHashZ*)untag_ptr(ptr);
2968         assert(obj->tag == LDKCOption_BlockHashZ_Some);
2969                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
2970                         memcpy(some_arr->elems, obj->some.data, 32);
2971         return some_arr;
2972 }
2973 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCOption_BlockHashZZ_get_a(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR owner){
2974         return ThirtyTwoBytes_clone(&owner->a);
2975 }
2976 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_get_a"))) TS_C2Tuple_TxidCOption_BlockHashZZ_get_a(uint64_t owner) {
2977         LDKC2Tuple_TxidCOption_BlockHashZZ* owner_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(owner);
2978         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
2979         memcpy(ret_arr->elems, C2Tuple_TxidCOption_BlockHashZZ_get_a(owner_conv).data, 32);
2980         return ret_arr;
2981 }
2982
2983 static inline struct LDKCOption_BlockHashZ C2Tuple_TxidCOption_BlockHashZZ_get_b(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR owner){
2984         return COption_BlockHashZ_clone(&owner->b);
2985 }
2986 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_get_b"))) TS_C2Tuple_TxidCOption_BlockHashZZ_get_b(uint64_t owner) {
2987         LDKC2Tuple_TxidCOption_BlockHashZZ* owner_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(owner);
2988         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
2989         *ret_copy = C2Tuple_TxidCOption_BlockHashZZ_get_b(owner_conv);
2990         uint64_t ret_ref = tag_ptr(ret_copy, true);
2991         return ret_ref;
2992 }
2993
2994 static inline LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ CVec_C2Tuple_TxidCOption_BlockHashZZZ_clone(const LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ *orig) {
2995         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ clone bytes"), .datalen = orig->datalen };
2996         for (size_t i = 0; i < ret.datalen; i++) {
2997                 ret.data[i] = C2Tuple_TxidCOption_BlockHashZZ_clone(&orig->data[i]);
2998         }
2999         return ret;
3000 }
3001 uint32_t __attribute__((export_name("TS_LDKMonitorEvent_ty_from_ptr"))) TS_LDKMonitorEvent_ty_from_ptr(uint64_t ptr) {
3002         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3003         switch(obj->tag) {
3004                 case LDKMonitorEvent_HTLCEvent: return 0;
3005                 case LDKMonitorEvent_CommitmentTxConfirmed: return 1;
3006                 case LDKMonitorEvent_Completed: return 2;
3007                 case LDKMonitorEvent_UpdateFailed: return 3;
3008                 default: abort();
3009         }
3010 }
3011 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_HTLCEvent_get_htlc_event"))) TS_LDKMonitorEvent_HTLCEvent_get_htlc_event(uint64_t ptr) {
3012         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3013         assert(obj->tag == LDKMonitorEvent_HTLCEvent);
3014                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
3015                         uint64_t htlc_event_ref = 0;
3016                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
3017                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
3018         return htlc_event_ref;
3019 }
3020 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed"))) TS_LDKMonitorEvent_CommitmentTxConfirmed_get_commitment_tx_confirmed(uint64_t ptr) {
3021         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3022         assert(obj->tag == LDKMonitorEvent_CommitmentTxConfirmed);
3023                         LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
3024                         uint64_t commitment_tx_confirmed_ref = 0;
3025                         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_confirmed_var);
3026                         commitment_tx_confirmed_ref = tag_ptr(commitment_tx_confirmed_var.inner, false);
3027         return commitment_tx_confirmed_ref;
3028 }
3029 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_funding_txo"))) TS_LDKMonitorEvent_Completed_get_funding_txo(uint64_t ptr) {
3030         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3031         assert(obj->tag == LDKMonitorEvent_Completed);
3032                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
3033                         uint64_t funding_txo_ref = 0;
3034                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
3035                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
3036         return funding_txo_ref;
3037 }
3038 int64_t __attribute__((export_name("TS_LDKMonitorEvent_Completed_get_monitor_update_id"))) TS_LDKMonitorEvent_Completed_get_monitor_update_id(uint64_t ptr) {
3039         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3040         assert(obj->tag == LDKMonitorEvent_Completed);
3041                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
3042         return monitor_update_id_conv;
3043 }
3044 uint64_t __attribute__((export_name("TS_LDKMonitorEvent_UpdateFailed_get_update_failed"))) TS_LDKMonitorEvent_UpdateFailed_get_update_failed(uint64_t ptr) {
3045         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
3046         assert(obj->tag == LDKMonitorEvent_UpdateFailed);
3047                         LDKOutPoint update_failed_var = obj->update_failed;
3048                         uint64_t update_failed_ref = 0;
3049                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_failed_var);
3050                         update_failed_ref = tag_ptr(update_failed_var.inner, false);
3051         return update_failed_ref;
3052 }
3053 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
3054         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
3055         for (size_t i = 0; i < ret.datalen; i++) {
3056                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
3057         }
3058         return ret;
3059 }
3060 static inline struct LDKOutPoint C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3061         LDKOutPoint ret = owner->a;
3062         ret.is_owned = false;
3063         return ret;
3064 }
3065 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(uint64_t owner) {
3066         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3067         LDKOutPoint ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
3068         uint64_t ret_ref = 0;
3069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3071         return ret_ref;
3072 }
3073
3074 static inline struct LDKCVec_MonitorEventZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3075         return CVec_MonitorEventZ_clone(&owner->b);
3076 }
3077 uint64_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(uint64_t owner) {
3078         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3079         LDKCVec_MonitorEventZ ret_var = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
3080         uint64_tArray ret_arr = NULL;
3081         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
3082         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
3083         for (size_t o = 0; o < ret_var.datalen; o++) {
3084                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3085                 *ret_conv_14_copy = ret_var.data[o];
3086                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
3087                 ret_arr_ptr[o] = ret_conv_14_ref;
3088         }
3089         
3090         FREE(ret_var.data);
3091         return ret_arr;
3092 }
3093
3094 static inline struct LDKPublicKey C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
3095         return owner->c;
3096 }
3097 int8_tArray  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(uint64_t owner) {
3098         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
3099         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
3100         memcpy(ret_arr->elems, C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_get_c(owner_conv).compressed_form, 33);
3101         return ret_arr;
3102 }
3103
3104 static inline LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ *orig) {
3105         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
3106         for (size_t i = 0; i < ret.datalen; i++) {
3107                 ret.data[i] = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
3108         }
3109         return ret;
3110 }
3111 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3112         LDKFixedPenaltyScorer ret = *owner->contents.result;
3113         ret.is_owned = false;
3114         return ret;
3115 }
3116 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(uint64_t owner) {
3117         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3118         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
3119         uint64_t ret_ref = 0;
3120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3122         return ret_ref;
3123 }
3124
3125 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
3126 CHECK(!owner->result_ok);
3127         return DecodeError_clone(&*owner->contents.err);
3128 }
3129 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_get_err(uint64_t owner) {
3130         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
3131         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3132         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
3133         uint64_t ret_ref = tag_ptr(ret_copy, true);
3134         return ret_ref;
3135 }
3136
3137 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
3138         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
3139         for (size_t i = 0; i < ret.datalen; i++) {
3140                 ret.data[i] = NodeId_clone(&orig->data[i]);
3141         }
3142         return ret;
3143 }
3144 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3145         return owner->a;
3146 }
3147 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_a"))) TS_C2Tuple_u64u64Z_get_a(uint64_t owner) {
3148         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3149         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
3150         return ret_conv;
3151 }
3152
3153 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
3154         return owner->b;
3155 }
3156 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_get_b"))) TS_C2Tuple_u64u64Z_get_b(uint64_t owner) {
3157         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
3158         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
3159         return ret_conv;
3160 }
3161
3162 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_u64u64ZZ_ty_from_ptr(uint64_t ptr) {
3163         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3164         switch(obj->tag) {
3165                 case LDKCOption_C2Tuple_u64u64ZZ_Some: return 0;
3166                 case LDKCOption_C2Tuple_u64u64ZZ_None: return 1;
3167                 default: abort();
3168         }
3169 }
3170 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_some(uint64_t ptr) {
3171         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
3172         assert(obj->tag == LDKCOption_C2Tuple_u64u64ZZ_Some);
3173                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3174                         *some_conv = obj->some;
3175                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
3176         return tag_ptr(some_conv, true);
3177 }
3178 static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
3179         return owner->a;
3180 }
3181 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) {
3182         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3183         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3184         memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 8 * 2);
3185         return ret_arr;
3186 }
3187
3188 static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
3189         return owner->b;
3190 }
3191 int16_tArray  __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) {
3192         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
3193         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3194         memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 8 * 2);
3195         return ret_arr;
3196 }
3197
3198 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
3199         return owner->a;
3200 }
3201 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_a"))) TS_C2Tuple__u168_u168Z_get_a(uint64_t owner) {
3202         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
3203         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3204         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_a(owner_conv).data, 8 * 2);
3205         return ret_arr;
3206 }
3207
3208 static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){
3209         return owner->b;
3210 }
3211 int16_tArray  __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_b"))) TS_C2Tuple__u168_u168Z_get_b(uint64_t owner) {
3212         LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner);
3213         int16_tArray ret_arr = init_int16_tArray(8, __LINE__);
3214         memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_b(owner_conv).data, 8 * 2);
3215         return ret_arr;
3216 }
3217
3218 uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr(uint64_t ptr) {
3219         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
3220         switch(obj->tag) {
3221                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: return 0;
3222                 case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: return 1;
3223                 default: abort();
3224         }
3225 }
3226 uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some(uint64_t ptr) {
3227         LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr);
3228         assert(obj->tag == LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some);
3229                         LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
3230                         *some_conv = obj->some;
3231                         *some_conv = C2Tuple__u168_u168Z_clone(some_conv);
3232         return tag_ptr(some_conv, true);
3233 }
3234 typedef struct LDKLogger_JCalls {
3235         atomic_size_t refcnt;
3236         uint32_t instance_ptr;
3237 } LDKLogger_JCalls;
3238 static void LDKLogger_JCalls_free(void* this_arg) {
3239         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3240         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3241                 FREE(j_calls);
3242         }
3243 }
3244 void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) {
3245         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
3246         LDKRecord record_var = *record;
3247         uint64_t record_ref = 0;
3248         record_var = Record_clone(&record_var);
3249         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
3250         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
3251         js_invoke_function_buuuuu(j_calls->instance_ptr, 16, record_ref, 0, 0, 0, 0, 0);
3252 }
3253 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
3254         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
3255         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3256 }
3257 static inline LDKLogger LDKLogger_init (JSValue o) {
3258         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
3259         atomic_init(&calls->refcnt, 1);
3260         calls->instance_ptr = o;
3261
3262         LDKLogger ret = {
3263                 .this_arg = (void*) calls,
3264                 .log = log_LDKLogger_jcall,
3265                 .free = LDKLogger_JCalls_free,
3266         };
3267         return ret;
3268 }
3269 uint64_t  __attribute__((export_name("TS_LDKLogger_new"))) TS_LDKLogger_new(JSValue o) {
3270         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
3271         *res_ptr = LDKLogger_init(o);
3272         return tag_ptr(res_ptr, true);
3273 }
3274 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3275         LDKProbabilisticScorer ret = *owner->contents.result;
3276         ret.is_owned = false;
3277         return ret;
3278 }
3279 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_ok(uint64_t owner) {
3280         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3281         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
3282         uint64_t ret_ref = 0;
3283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3285         return ret_ref;
3286 }
3287
3288 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
3289 CHECK(!owner->result_ok);
3290         return DecodeError_clone(&*owner->contents.err);
3291 }
3292 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_get_err(uint64_t owner) {
3293         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
3294         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3295         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
3296         uint64_t ret_ref = tag_ptr(ret_copy, true);
3297         return ret_ref;
3298 }
3299
3300 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3301         LDKInitFeatures ret = *owner->contents.result;
3302         ret.is_owned = false;
3303         return ret;
3304 }
3305 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3306         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3307         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
3308         uint64_t ret_ref = 0;
3309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3311         return ret_ref;
3312 }
3313
3314 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
3315 CHECK(!owner->result_ok);
3316         return DecodeError_clone(&*owner->contents.err);
3317 }
3318 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_get_err"))) TS_CResult_InitFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3319         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
3320         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3321         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
3322         uint64_t ret_ref = tag_ptr(ret_copy, true);
3323         return ret_ref;
3324 }
3325
3326 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3327         LDKChannelFeatures ret = *owner->contents.result;
3328         ret.is_owned = false;
3329         return ret;
3330 }
3331 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3332         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3333         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
3334         uint64_t ret_ref = 0;
3335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3337         return ret_ref;
3338 }
3339
3340 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
3341 CHECK(!owner->result_ok);
3342         return DecodeError_clone(&*owner->contents.err);
3343 }
3344 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3345         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
3346         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3347         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
3348         uint64_t ret_ref = tag_ptr(ret_copy, true);
3349         return ret_ref;
3350 }
3351
3352 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3353         LDKNodeFeatures ret = *owner->contents.result;
3354         ret.is_owned = false;
3355         return ret;
3356 }
3357 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3358         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3359         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
3360         uint64_t ret_ref = 0;
3361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3363         return ret_ref;
3364 }
3365
3366 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3367 CHECK(!owner->result_ok);
3368         return DecodeError_clone(&*owner->contents.err);
3369 }
3370 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_get_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3371         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
3372         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3373         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
3374         uint64_t ret_ref = tag_ptr(ret_copy, true);
3375         return ret_ref;
3376 }
3377
3378 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3379         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
3380         ret.is_owned = false;
3381         return ret;
3382 }
3383 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3384         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3385         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3386         uint64_t ret_ref = 0;
3387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3389         return ret_ref;
3390 }
3391
3392 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3393 CHECK(!owner->result_ok);
3394         return DecodeError_clone(&*owner->contents.err);
3395 }
3396 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3397         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3398         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3399         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3400         uint64_t ret_ref = tag_ptr(ret_copy, true);
3401         return ret_ref;
3402 }
3403
3404 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3405         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
3406         ret.is_owned = false;
3407         return ret;
3408 }
3409 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3410         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3411         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
3412         uint64_t ret_ref = 0;
3413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3415         return ret_ref;
3416 }
3417
3418 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
3419 CHECK(!owner->result_ok);
3420         return DecodeError_clone(&*owner->contents.err);
3421 }
3422 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3423         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
3424         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3425         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
3426         uint64_t ret_ref = tag_ptr(ret_copy, true);
3427         return ret_ref;
3428 }
3429
3430 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3431         LDKBlindedHopFeatures ret = *owner->contents.result;
3432         ret.is_owned = false;
3433         return ret;
3434 }
3435 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3436         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3437         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
3438         uint64_t ret_ref = 0;
3439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3441         return ret_ref;
3442 }
3443
3444 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
3445 CHECK(!owner->result_ok);
3446         return DecodeError_clone(&*owner->contents.err);
3447 }
3448 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3449         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
3450         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3451         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
3452         uint64_t ret_ref = tag_ptr(ret_copy, true);
3453         return ret_ref;
3454 }
3455
3456 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3457         LDKChannelTypeFeatures ret = *owner->contents.result;
3458         ret.is_owned = false;
3459         return ret;
3460 }
3461 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) {
3462         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3463         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
3464         uint64_t ret_ref = 0;
3465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3467         return ret_ref;
3468 }
3469
3470 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
3471 CHECK(!owner->result_ok);
3472         return DecodeError_clone(&*owner->contents.err);
3473 }
3474 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) {
3475         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
3476         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3477         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
3478         uint64_t ret_ref = tag_ptr(ret_copy, true);
3479         return ret_ref;
3480 }
3481
3482 uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) {
3483         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
3484         switch(obj->tag) {
3485                 case LDKPaymentPurpose_InvoicePayment: return 0;
3486                 case LDKPaymentPurpose_SpontaneousPayment: return 1;
3487                 default: abort();
3488         }
3489 }
3490 uint64_t __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_preimage(uint64_t ptr) {
3491         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
3492         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
3493                         uint64_t payment_preimage_ref = tag_ptr(&obj->invoice_payment.payment_preimage, false);
3494         return payment_preimage_ref;
3495 }
3496 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret"))) TS_LDKPaymentPurpose_InvoicePayment_get_payment_secret(uint64_t ptr) {
3497         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
3498         assert(obj->tag == LDKPaymentPurpose_InvoicePayment);
3499                         int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__);
3500                         memcpy(payment_secret_arr->elems, obj->invoice_payment.payment_secret.data, 32);
3501         return payment_secret_arr;
3502 }
3503 int8_tArray __attribute__((export_name("TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment"))) TS_LDKPaymentPurpose_SpontaneousPayment_get_spontaneous_payment(uint64_t ptr) {
3504         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
3505         assert(obj->tag == LDKPaymentPurpose_SpontaneousPayment);
3506                         int8_tArray spontaneous_payment_arr = init_int8_tArray(32, __LINE__);
3507                         memcpy(spontaneous_payment_arr->elems, obj->spontaneous_payment.data, 32);
3508         return spontaneous_payment_arr;
3509 }
3510 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
3511 CHECK(owner->result_ok);
3512         return PaymentPurpose_clone(&*owner->contents.result);
3513 }
3514 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_ok(uint64_t owner) {
3515         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
3516         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
3517         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
3518         uint64_t ret_ref = tag_ptr(ret_copy, true);
3519         return ret_ref;
3520 }
3521
3522 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
3523 CHECK(!owner->result_ok);
3524         return DecodeError_clone(&*owner->contents.err);
3525 }
3526 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_get_err(uint64_t owner) {
3527         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
3528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3529         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
3530         uint64_t ret_ref = tag_ptr(ret_copy, true);
3531         return ret_ref;
3532 }
3533
3534 uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) {
3535         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3536         switch(obj->tag) {
3537                 case LDKNetworkUpdate_ChannelUpdateMessage: return 0;
3538                 case LDKNetworkUpdate_ChannelFailure: return 1;
3539                 case LDKNetworkUpdate_NodeFailure: return 2;
3540                 default: abort();
3541         }
3542 }
3543 uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) {
3544         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3545         assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage);
3546                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
3547                         uint64_t msg_ref = 0;
3548                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3549                         msg_ref = tag_ptr(msg_var.inner, false);
3550         return msg_ref;
3551 }
3552 int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) {
3553         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3554         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3555                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
3556         return short_channel_id_conv;
3557 }
3558 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) {
3559         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3560         assert(obj->tag == LDKNetworkUpdate_ChannelFailure);
3561                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
3562         return is_permanent_conv;
3563 }
3564 int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) {
3565         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3566         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3567                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3568                         memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33);
3569         return node_id_arr;
3570 }
3571 jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) {
3572         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
3573         assert(obj->tag == LDKNetworkUpdate_NodeFailure);
3574                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
3575         return is_permanent_conv;
3576 }
3577 uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) {
3578         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3579         switch(obj->tag) {
3580                 case LDKCOption_NetworkUpdateZ_Some: return 0;
3581                 case LDKCOption_NetworkUpdateZ_None: return 1;
3582                 default: abort();
3583         }
3584 }
3585 uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) {
3586         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
3587         assert(obj->tag == LDKCOption_NetworkUpdateZ_Some);
3588                         uint64_t some_ref = tag_ptr(&obj->some, false);
3589         return some_ref;
3590 }
3591 uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) {
3592         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
3593         switch(obj->tag) {
3594                 case LDKPathFailure_InitialSend: return 0;
3595                 case LDKPathFailure_OnPath: return 1;
3596                 default: abort();
3597         }
3598 }
3599 uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) {
3600         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
3601         assert(obj->tag == LDKPathFailure_InitialSend);
3602                         uint64_t err_ref = tag_ptr(&obj->initial_send.err, false);
3603         return err_ref;
3604 }
3605 uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) {
3606         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
3607         assert(obj->tag == LDKPathFailure_OnPath);
3608                         uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
3609         return network_update_ref;
3610 }
3611 uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) {
3612         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
3613         switch(obj->tag) {
3614                 case LDKCOption_PathFailureZ_Some: return 0;
3615                 case LDKCOption_PathFailureZ_None: return 1;
3616                 default: abort();
3617         }
3618 }
3619 uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) {
3620         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
3621         assert(obj->tag == LDKCOption_PathFailureZ_Some);
3622                         uint64_t some_ref = tag_ptr(&obj->some, false);
3623         return some_ref;
3624 }
3625 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
3626 CHECK(owner->result_ok);
3627         return COption_PathFailureZ_clone(&*owner->contents.result);
3628 }
3629 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) {
3630         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
3631         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
3632         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
3633         uint64_t ret_ref = tag_ptr(ret_copy, true);
3634         return ret_ref;
3635 }
3636
3637 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
3638 CHECK(!owner->result_ok);
3639         return DecodeError_clone(&*owner->contents.err);
3640 }
3641 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) {
3642         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
3643         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3644         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
3645         uint64_t ret_ref = tag_ptr(ret_copy, true);
3646         return ret_ref;
3647 }
3648
3649 uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) {
3650         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3651         switch(obj->tag) {
3652                 case LDKClosureReason_CounterpartyForceClosed: return 0;
3653                 case LDKClosureReason_HolderForceClosed: return 1;
3654                 case LDKClosureReason_CooperativeClosure: return 2;
3655                 case LDKClosureReason_CommitmentTxConfirmed: return 3;
3656                 case LDKClosureReason_FundingTimedOut: return 4;
3657                 case LDKClosureReason_ProcessingError: return 5;
3658                 case LDKClosureReason_DisconnectedPeer: return 6;
3659                 case LDKClosureReason_OutdatedChannelManager: return 7;
3660                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: return 8;
3661                 default: abort();
3662         }
3663 }
3664 uint64_t __attribute__((export_name("TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg"))) TS_LDKClosureReason_CounterpartyForceClosed_get_peer_msg(uint64_t ptr) {
3665         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3666         assert(obj->tag == LDKClosureReason_CounterpartyForceClosed);
3667                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
3668                         uint64_t peer_msg_ref = 0;
3669                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
3670                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
3671         return peer_msg_ref;
3672 }
3673 jstring __attribute__((export_name("TS_LDKClosureReason_ProcessingError_get_err"))) TS_LDKClosureReason_ProcessingError_get_err(uint64_t ptr) {
3674         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
3675         assert(obj->tag == LDKClosureReason_ProcessingError);
3676                         LDKStr err_str = obj->processing_error.err;
3677                         jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
3678         return err_conv;
3679 }
3680 uint32_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_ty_from_ptr"))) TS_LDKCOption_ClosureReasonZ_ty_from_ptr(uint64_t ptr) {
3681         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
3682         switch(obj->tag) {
3683                 case LDKCOption_ClosureReasonZ_Some: return 0;
3684                 case LDKCOption_ClosureReasonZ_None: return 1;
3685                 default: abort();
3686         }
3687 }
3688 uint64_t __attribute__((export_name("TS_LDKCOption_ClosureReasonZ_Some_get_some"))) TS_LDKCOption_ClosureReasonZ_Some_get_some(uint64_t ptr) {
3689         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
3690         assert(obj->tag == LDKCOption_ClosureReasonZ_Some);
3691                         uint64_t some_ref = tag_ptr(&obj->some, false);
3692         return some_ref;
3693 }
3694 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3695 CHECK(owner->result_ok);
3696         return COption_ClosureReasonZ_clone(&*owner->contents.result);
3697 }
3698 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(uint64_t owner) {
3699         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
3700         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
3701         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
3702         uint64_t ret_ref = tag_ptr(ret_copy, true);
3703         return ret_ref;
3704 }
3705
3706 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
3707 CHECK(!owner->result_ok);
3708         return DecodeError_clone(&*owner->contents.err);
3709 }
3710 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_get_err(uint64_t owner) {
3711         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
3712         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3713         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
3714         uint64_t ret_ref = tag_ptr(ret_copy, true);
3715         return ret_ref;
3716 }
3717
3718 uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LDKHTLCDestination_ty_from_ptr(uint64_t ptr) {
3719         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3720         switch(obj->tag) {
3721                 case LDKHTLCDestination_NextHopChannel: return 0;
3722                 case LDKHTLCDestination_UnknownNextHop: return 1;
3723                 case LDKHTLCDestination_InvalidForward: return 2;
3724                 case LDKHTLCDestination_FailedPayment: return 3;
3725                 default: abort();
3726         }
3727 }
3728 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_node_id"))) TS_LDKHTLCDestination_NextHopChannel_get_node_id(uint64_t ptr) {
3729         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3730         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
3731                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
3732                         memcpy(node_id_arr->elems, obj->next_hop_channel.node_id.compressed_form, 33);
3733         return node_id_arr;
3734 }
3735 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_NextHopChannel_get_channel_id"))) TS_LDKHTLCDestination_NextHopChannel_get_channel_id(uint64_t ptr) {
3736         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3737         assert(obj->tag == LDKHTLCDestination_NextHopChannel);
3738                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
3739                         memcpy(channel_id_arr->elems, obj->next_hop_channel.channel_id.data, 32);
3740         return channel_id_arr;
3741 }
3742 int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid"))) TS_LDKHTLCDestination_UnknownNextHop_get_requested_forward_scid(uint64_t ptr) {
3743         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3744         assert(obj->tag == LDKHTLCDestination_UnknownNextHop);
3745                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
3746         return requested_forward_scid_conv;
3747 }
3748 int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) {
3749         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3750         assert(obj->tag == LDKHTLCDestination_InvalidForward);
3751                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
3752         return requested_forward_scid_conv;
3753 }
3754 int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) {
3755         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
3756         assert(obj->tag == LDKHTLCDestination_FailedPayment);
3757                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
3758                         memcpy(payment_hash_arr->elems, obj->failed_payment.payment_hash.data, 32);
3759         return payment_hash_arr;
3760 }
3761 uint32_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_ty_from_ptr"))) TS_LDKCOption_HTLCDestinationZ_ty_from_ptr(uint64_t ptr) {
3762         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
3763         switch(obj->tag) {
3764                 case LDKCOption_HTLCDestinationZ_Some: return 0;
3765                 case LDKCOption_HTLCDestinationZ_None: return 1;
3766                 default: abort();
3767         }
3768 }
3769 uint64_t __attribute__((export_name("TS_LDKCOption_HTLCDestinationZ_Some_get_some"))) TS_LDKCOption_HTLCDestinationZ_Some_get_some(uint64_t ptr) {
3770         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
3771         assert(obj->tag == LDKCOption_HTLCDestinationZ_Some);
3772                         uint64_t some_ref = tag_ptr(&obj->some, false);
3773         return some_ref;
3774 }
3775 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
3776 CHECK(owner->result_ok);
3777         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
3778 }
3779 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(uint64_t owner) {
3780         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
3781         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
3782         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
3783         uint64_t ret_ref = tag_ptr(ret_copy, true);
3784         return ret_ref;
3785 }
3786
3787 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
3788 CHECK(!owner->result_ok);
3789         return DecodeError_clone(&*owner->contents.err);
3790 }
3791 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(uint64_t owner) {
3792         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
3793         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3794         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
3795         uint64_t ret_ref = tag_ptr(ret_copy, true);
3796         return ret_ref;
3797 }
3798
3799 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
3800 CHECK(owner->result_ok);
3801         return PaymentFailureReason_clone(&*owner->contents.result);
3802 }
3803 uint32_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_ok(uint64_t owner) {
3804         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
3805         uint32_t ret_conv = LDKPaymentFailureReason_to_js(CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
3806         return ret_conv;
3807 }
3808
3809 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
3810 CHECK(!owner->result_ok);
3811         return DecodeError_clone(&*owner->contents.err);
3812 }
3813 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_get_err(uint64_t owner) {
3814         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
3815         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3816         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
3817         uint64_t ret_ref = tag_ptr(ret_copy, true);
3818         return ret_ref;
3819 }
3820
3821 uint32_t __attribute__((export_name("TS_LDKCOption_u128Z_ty_from_ptr"))) TS_LDKCOption_u128Z_ty_from_ptr(uint64_t ptr) {
3822         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
3823         switch(obj->tag) {
3824                 case LDKCOption_u128Z_Some: return 0;
3825                 case LDKCOption_u128Z_None: return 1;
3826                 default: abort();
3827         }
3828 }
3829 int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS_LDKCOption_u128Z_Some_get_some(uint64_t ptr) {
3830         LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr);
3831         assert(obj->tag == LDKCOption_u128Z_Some);
3832                         int8_tArray some_arr = init_int8_tArray(16, __LINE__);
3833                         memcpy(some_arr->elems, obj->some.le_bytes, 16);
3834         return some_arr;
3835 }
3836 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentIdZ_ty_from_ptr"))) TS_LDKCOption_PaymentIdZ_ty_from_ptr(uint64_t ptr) {
3837         LDKCOption_PaymentIdZ *obj = (LDKCOption_PaymentIdZ*)untag_ptr(ptr);
3838         switch(obj->tag) {
3839                 case LDKCOption_PaymentIdZ_Some: return 0;
3840                 case LDKCOption_PaymentIdZ_None: return 1;
3841                 default: abort();
3842         }
3843 }
3844 int8_tArray __attribute__((export_name("TS_LDKCOption_PaymentIdZ_Some_get_some"))) TS_LDKCOption_PaymentIdZ_Some_get_some(uint64_t ptr) {
3845         LDKCOption_PaymentIdZ *obj = (LDKCOption_PaymentIdZ*)untag_ptr(ptr);
3846         assert(obj->tag == LDKCOption_PaymentIdZ_Some);
3847                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
3848                         memcpy(some_arr->elems, obj->some.data, 32);
3849         return some_arr;
3850 }
3851 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr"))) TS_LDKCOption_PaymentFailureReasonZ_ty_from_ptr(uint64_t ptr) {
3852         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
3853         switch(obj->tag) {
3854                 case LDKCOption_PaymentFailureReasonZ_Some: return 0;
3855                 case LDKCOption_PaymentFailureReasonZ_None: return 1;
3856                 default: abort();
3857         }
3858 }
3859 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentFailureReasonZ_Some_get_some"))) TS_LDKCOption_PaymentFailureReasonZ_Some_get_some(uint64_t ptr) {
3860         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
3861         assert(obj->tag == LDKCOption_PaymentFailureReasonZ_Some);
3862                         uint32_t some_conv = LDKPaymentFailureReason_to_js(obj->some);
3863         return some_conv;
3864 }
3865 uint32_t __attribute__((export_name("TS_LDKCOption_PaymentHashZ_ty_from_ptr"))) TS_LDKCOption_PaymentHashZ_ty_from_ptr(uint64_t ptr) {
3866         LDKCOption_PaymentHashZ *obj = (LDKCOption_PaymentHashZ*)untag_ptr(ptr);
3867         switch(obj->tag) {
3868                 case LDKCOption_PaymentHashZ_Some: return 0;
3869                 case LDKCOption_PaymentHashZ_None: return 1;
3870                 default: abort();
3871         }
3872 }
3873 int8_tArray __attribute__((export_name("TS_LDKCOption_PaymentHashZ_Some_get_some"))) TS_LDKCOption_PaymentHashZ_Some_get_some(uint64_t ptr) {
3874         LDKCOption_PaymentHashZ *obj = (LDKCOption_PaymentHashZ*)untag_ptr(ptr);
3875         assert(obj->tag == LDKCOption_PaymentHashZ_Some);
3876                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
3877                         memcpy(some_arr->elems, obj->some.data, 32);
3878         return some_arr;
3879 }
3880 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
3881         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
3882         for (size_t i = 0; i < ret.datalen; i++) {
3883                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
3884         }
3885         return ret;
3886 }
3887 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
3888         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
3889         for (size_t i = 0; i < ret.datalen; i++) {
3890                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
3891         }
3892         return ret;
3893 }
3894 uint32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ty_from_ptr"))) TS_LDKBumpTransactionEvent_ty_from_ptr(uint64_t ptr) {
3895         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3896         switch(obj->tag) {
3897                 case LDKBumpTransactionEvent_ChannelClose: return 0;
3898                 case LDKBumpTransactionEvent_HTLCResolution: return 1;
3899                 default: abort();
3900         }
3901 }
3902 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id"))) TS_LDKBumpTransactionEvent_ChannelClose_get_claim_id(uint64_t ptr) {
3903         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3904         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3905                         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
3906                         memcpy(claim_id_arr->elems, obj->channel_close.claim_id.data, 32);
3907         return claim_id_arr;
3908 }
3909 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) {
3910         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3911         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3912                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
3913         return package_target_feerate_sat_per_1000_weight_conv;
3914 }
3915 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(uint64_t ptr) {
3916         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3917         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3918                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
3919                         int8_tArray commitment_tx_arr = init_int8_tArray(commitment_tx_var.datalen, __LINE__);
3920                         memcpy(commitment_tx_arr->elems, commitment_tx_var.data, commitment_tx_var.datalen);
3921         return commitment_tx_arr;
3922 }
3923 int64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis"))) TS_LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(uint64_t ptr) {
3924         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3925         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3926                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
3927         return commitment_tx_fee_satoshis_conv;
3928 }
3929 uint64_t __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor"))) TS_LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(uint64_t ptr) {
3930         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3931         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3932                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
3933                         uint64_t anchor_descriptor_ref = 0;
3934                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
3935                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
3936         return anchor_descriptor_ref;
3937 }
3938 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs"))) TS_LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(uint64_t ptr) {
3939         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3940         assert(obj->tag == LDKBumpTransactionEvent_ChannelClose);
3941                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
3942                         uint64_tArray pending_htlcs_arr = NULL;
3943                         pending_htlcs_arr = init_uint64_tArray(pending_htlcs_var.datalen, __LINE__);
3944                         uint64_t *pending_htlcs_arr_ptr = (uint64_t*)(((uint8_t*)pending_htlcs_arr) + 8);
3945                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
3946                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
3947                                 uint64_t pending_htlcs_conv_24_ref = 0;
3948                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
3949                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
3950                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
3951                         }
3952                         
3953         return pending_htlcs_arr;
3954 }
3955 int8_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_claim_id(uint64_t ptr) {
3956         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3957         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
3958                         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
3959                         memcpy(claim_id_arr->elems, obj->htlc_resolution.claim_id.data, 32);
3960         return claim_id_arr;
3961 }
3962 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) {
3963         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3964         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
3965                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
3966         return target_feerate_sat_per_1000_weight_conv;
3967 }
3968 uint64_tArray __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(uint64_t ptr) {
3969         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3970         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
3971                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
3972                         uint64_tArray htlc_descriptors_arr = NULL;
3973                         htlc_descriptors_arr = init_uint64_tArray(htlc_descriptors_var.datalen, __LINE__);
3974                         uint64_t *htlc_descriptors_arr_ptr = (uint64_t*)(((uint8_t*)htlc_descriptors_arr) + 8);
3975                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
3976                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
3977                                 uint64_t htlc_descriptors_conv_16_ref = 0;
3978                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
3979                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
3980                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
3981                         }
3982                         
3983         return htlc_descriptors_arr;
3984 }
3985 int32_t __attribute__((export_name("TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time"))) TS_LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(uint64_t ptr) {
3986         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
3987         assert(obj->tag == LDKBumpTransactionEvent_HTLCResolution);
3988                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
3989         return tx_lock_time_conv;
3990 }
3991 uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_from_ptr(uint64_t ptr) {
3992         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
3993         switch(obj->tag) {
3994                 case LDKEvent_FundingGenerationReady: return 0;
3995                 case LDKEvent_PaymentClaimable: return 1;
3996                 case LDKEvent_PaymentClaimed: return 2;
3997                 case LDKEvent_PaymentSent: return 3;
3998                 case LDKEvent_PaymentFailed: return 4;
3999                 case LDKEvent_PaymentPathSuccessful: return 5;
4000                 case LDKEvent_PaymentPathFailed: return 6;
4001                 case LDKEvent_ProbeSuccessful: return 7;
4002                 case LDKEvent_ProbeFailed: return 8;
4003                 case LDKEvent_PendingHTLCsForwardable: return 9;
4004                 case LDKEvent_HTLCIntercepted: return 10;
4005                 case LDKEvent_SpendableOutputs: return 11;
4006                 case LDKEvent_PaymentForwarded: return 12;
4007                 case LDKEvent_ChannelPending: return 13;
4008                 case LDKEvent_ChannelReady: return 14;
4009                 case LDKEvent_ChannelClosed: return 15;
4010                 case LDKEvent_DiscardFunding: return 16;
4011                 case LDKEvent_OpenChannelRequest: return 17;
4012                 case LDKEvent_HTLCHandlingFailed: return 18;
4013                 case LDKEvent_BumpTransaction: return 19;
4014                 default: abort();
4015         }
4016 }
4017 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_temporary_channel_id(uint64_t ptr) {
4018         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4019         assert(obj->tag == LDKEvent_FundingGenerationReady);
4020                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
4021                         memcpy(temporary_channel_id_arr->elems, obj->funding_generation_ready.temporary_channel_id.data, 32);
4022         return temporary_channel_id_arr;
4023 }
4024 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id"))) TS_LDKEvent_FundingGenerationReady_get_counterparty_node_id(uint64_t ptr) {
4025         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4026         assert(obj->tag == LDKEvent_FundingGenerationReady);
4027                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
4028                         memcpy(counterparty_node_id_arr->elems, obj->funding_generation_ready.counterparty_node_id.compressed_form, 33);
4029         return counterparty_node_id_arr;
4030 }
4031 int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis"))) TS_LDKEvent_FundingGenerationReady_get_channel_value_satoshis(uint64_t ptr) {
4032         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4033         assert(obj->tag == LDKEvent_FundingGenerationReady);
4034                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
4035         return channel_value_satoshis_conv;
4036 }
4037 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_output_script"))) TS_LDKEvent_FundingGenerationReady_get_output_script(uint64_t ptr) {
4038         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4039         assert(obj->tag == LDKEvent_FundingGenerationReady);
4040                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4041                         int8_tArray output_script_arr = init_int8_tArray(output_script_var.datalen, __LINE__);
4042                         memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen);
4043         return output_script_arr;
4044 }
4045 int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) {
4046         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4047         assert(obj->tag == LDKEvent_FundingGenerationReady);
4048                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
4049                         memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16);
4050         return user_channel_id_arr;
4051 }
4052 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) {
4053         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4054         assert(obj->tag == LDKEvent_PaymentClaimable);
4055                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
4056                         memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33);
4057         return receiver_node_id_arr;
4058 }
4059 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) {
4060         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4061         assert(obj->tag == LDKEvent_PaymentClaimable);
4062                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4063                         memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32);
4064         return payment_hash_arr;
4065 }
4066 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_onion_fields"))) TS_LDKEvent_PaymentClaimable_get_onion_fields(uint64_t ptr) {
4067         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4068         assert(obj->tag == LDKEvent_PaymentClaimable);
4069                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
4070                         uint64_t onion_fields_ref = 0;
4071                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
4072                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
4073         return onion_fields_ref;
4074 }
4075 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) {
4076         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4077         assert(obj->tag == LDKEvent_PaymentClaimable);
4078                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
4079         return amount_msat_conv;
4080 }
4081 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat"))) TS_LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(uint64_t ptr) {
4082         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4083         assert(obj->tag == LDKEvent_PaymentClaimable);
4084                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
4085         return counterparty_skimmed_fee_msat_conv;
4086 }
4087 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) {
4088         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4089         assert(obj->tag == LDKEvent_PaymentClaimable);
4090                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
4091         return purpose_ref;
4092 }
4093 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) {
4094         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4095         assert(obj->tag == LDKEvent_PaymentClaimable);
4096                         int8_tArray via_channel_id_arr = init_int8_tArray(32, __LINE__);
4097                         memcpy(via_channel_id_arr->elems, obj->payment_claimable.via_channel_id.data, 32);
4098         return via_channel_id_arr;
4099 }
4100 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) {
4101         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4102         assert(obj->tag == LDKEvent_PaymentClaimable);
4103                         uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
4104         return via_user_channel_id_ref;
4105 }
4106 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_claim_deadline"))) TS_LDKEvent_PaymentClaimable_get_claim_deadline(uint64_t ptr) {
4107         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4108         assert(obj->tag == LDKEvent_PaymentClaimable);
4109                         uint64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
4110         return claim_deadline_ref;
4111 }
4112 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) {
4113         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4114         assert(obj->tag == LDKEvent_PaymentClaimed);
4115                         int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__);
4116                         memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33);
4117         return receiver_node_id_arr;
4118 }
4119 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) {
4120         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4121         assert(obj->tag == LDKEvent_PaymentClaimed);
4122                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4123                         memcpy(payment_hash_arr->elems, obj->payment_claimed.payment_hash.data, 32);
4124         return payment_hash_arr;
4125 }
4126 int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_amount_msat"))) TS_LDKEvent_PaymentClaimed_get_amount_msat(uint64_t ptr) {
4127         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4128         assert(obj->tag == LDKEvent_PaymentClaimed);
4129                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
4130         return amount_msat_conv;
4131 }
4132 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_purpose"))) TS_LDKEvent_PaymentClaimed_get_purpose(uint64_t ptr) {
4133         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4134         assert(obj->tag == LDKEvent_PaymentClaimed);
4135                         uint64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
4136         return purpose_ref;
4137 }
4138 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_id"))) TS_LDKEvent_PaymentSent_get_payment_id(uint64_t ptr) {
4139         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4140         assert(obj->tag == LDKEvent_PaymentSent);
4141                         uint64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
4142         return payment_id_ref;
4143 }
4144 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_preimage"))) TS_LDKEvent_PaymentSent_get_payment_preimage(uint64_t ptr) {
4145         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4146         assert(obj->tag == LDKEvent_PaymentSent);
4147                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
4148                         memcpy(payment_preimage_arr->elems, obj->payment_sent.payment_preimage.data, 32);
4149         return payment_preimage_arr;
4150 }
4151 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentSent_get_payment_hash"))) TS_LDKEvent_PaymentSent_get_payment_hash(uint64_t ptr) {
4152         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4153         assert(obj->tag == LDKEvent_PaymentSent);
4154                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4155                         memcpy(payment_hash_arr->elems, obj->payment_sent.payment_hash.data, 32);
4156         return payment_hash_arr;
4157 }
4158 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentSent_get_fee_paid_msat"))) TS_LDKEvent_PaymentSent_get_fee_paid_msat(uint64_t ptr) {
4159         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4160         assert(obj->tag == LDKEvent_PaymentSent);
4161                         uint64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
4162         return fee_paid_msat_ref;
4163 }
4164 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_id"))) TS_LDKEvent_PaymentFailed_get_payment_id(uint64_t ptr) {
4165         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4166         assert(obj->tag == LDKEvent_PaymentFailed);
4167                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4168                         memcpy(payment_id_arr->elems, obj->payment_failed.payment_id.data, 32);
4169         return payment_id_arr;
4170 }
4171 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_payment_hash"))) TS_LDKEvent_PaymentFailed_get_payment_hash(uint64_t ptr) {
4172         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4173         assert(obj->tag == LDKEvent_PaymentFailed);
4174                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4175                         memcpy(payment_hash_arr->elems, obj->payment_failed.payment_hash.data, 32);
4176         return payment_hash_arr;
4177 }
4178 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentFailed_get_reason"))) TS_LDKEvent_PaymentFailed_get_reason(uint64_t ptr) {
4179         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4180         assert(obj->tag == LDKEvent_PaymentFailed);
4181                         uint64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
4182         return reason_ref;
4183 }
4184 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_id"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_id(uint64_t ptr) {
4185         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4186         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
4187                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4188                         memcpy(payment_id_arr->elems, obj->payment_path_successful.payment_id.data, 32);
4189         return payment_id_arr;
4190 }
4191 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_payment_hash"))) TS_LDKEvent_PaymentPathSuccessful_get_payment_hash(uint64_t ptr) {
4192         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4193         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
4194                         uint64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
4195         return payment_hash_ref;
4196 }
4197 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathSuccessful_get_path"))) TS_LDKEvent_PaymentPathSuccessful_get_path(uint64_t ptr) {
4198         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4199         assert(obj->tag == LDKEvent_PaymentPathSuccessful);
4200                         LDKPath path_var = obj->payment_path_successful.path;
4201                         uint64_t path_ref = 0;
4202                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4203                         path_ref = tag_ptr(path_var.inner, false);
4204         return path_ref;
4205 }
4206 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_id"))) TS_LDKEvent_PaymentPathFailed_get_payment_id(uint64_t ptr) {
4207         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4208         assert(obj->tag == LDKEvent_PaymentPathFailed);
4209                         uint64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
4210         return payment_id_ref;
4211 }
4212 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_hash"))) TS_LDKEvent_PaymentPathFailed_get_payment_hash(uint64_t ptr) {
4213         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4214         assert(obj->tag == LDKEvent_PaymentPathFailed);
4215                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4216                         memcpy(payment_hash_arr->elems, obj->payment_path_failed.payment_hash.data, 32);
4217         return payment_hash_arr;
4218 }
4219 jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently"))) TS_LDKEvent_PaymentPathFailed_get_payment_failed_permanently(uint64_t ptr) {
4220         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4221         assert(obj->tag == LDKEvent_PaymentPathFailed);
4222                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
4223         return payment_failed_permanently_conv;
4224 }
4225 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) {
4226         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4227         assert(obj->tag == LDKEvent_PaymentPathFailed);
4228                         uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
4229         return failure_ref;
4230 }
4231 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) {
4232         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4233         assert(obj->tag == LDKEvent_PaymentPathFailed);
4234                         LDKPath path_var = obj->payment_path_failed.path;
4235                         uint64_t path_ref = 0;
4236                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4237                         path_ref = tag_ptr(path_var.inner, false);
4238         return path_ref;
4239 }
4240 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_short_channel_id"))) TS_LDKEvent_PaymentPathFailed_get_short_channel_id(uint64_t ptr) {
4241         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4242         assert(obj->tag == LDKEvent_PaymentPathFailed);
4243                         uint64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
4244         return short_channel_id_ref;
4245 }
4246 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_id"))) TS_LDKEvent_ProbeSuccessful_get_payment_id(uint64_t ptr) {
4247         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4248         assert(obj->tag == LDKEvent_ProbeSuccessful);
4249                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4250                         memcpy(payment_id_arr->elems, obj->probe_successful.payment_id.data, 32);
4251         return payment_id_arr;
4252 }
4253 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_payment_hash"))) TS_LDKEvent_ProbeSuccessful_get_payment_hash(uint64_t ptr) {
4254         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4255         assert(obj->tag == LDKEvent_ProbeSuccessful);
4256                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4257                         memcpy(payment_hash_arr->elems, obj->probe_successful.payment_hash.data, 32);
4258         return payment_hash_arr;
4259 }
4260 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeSuccessful_get_path"))) TS_LDKEvent_ProbeSuccessful_get_path(uint64_t ptr) {
4261         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4262         assert(obj->tag == LDKEvent_ProbeSuccessful);
4263                         LDKPath path_var = obj->probe_successful.path;
4264                         uint64_t path_ref = 0;
4265                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4266                         path_ref = tag_ptr(path_var.inner, false);
4267         return path_ref;
4268 }
4269 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_id"))) TS_LDKEvent_ProbeFailed_get_payment_id(uint64_t ptr) {
4270         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4271         assert(obj->tag == LDKEvent_ProbeFailed);
4272                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
4273                         memcpy(payment_id_arr->elems, obj->probe_failed.payment_id.data, 32);
4274         return payment_id_arr;
4275 }
4276 int8_tArray __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_payment_hash"))) TS_LDKEvent_ProbeFailed_get_payment_hash(uint64_t ptr) {
4277         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4278         assert(obj->tag == LDKEvent_ProbeFailed);
4279                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4280                         memcpy(payment_hash_arr->elems, obj->probe_failed.payment_hash.data, 32);
4281         return payment_hash_arr;
4282 }
4283 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_path"))) TS_LDKEvent_ProbeFailed_get_path(uint64_t ptr) {
4284         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4285         assert(obj->tag == LDKEvent_ProbeFailed);
4286                         LDKPath path_var = obj->probe_failed.path;
4287                         uint64_t path_ref = 0;
4288                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4289                         path_ref = tag_ptr(path_var.inner, false);
4290         return path_ref;
4291 }
4292 uint64_t __attribute__((export_name("TS_LDKEvent_ProbeFailed_get_short_channel_id"))) TS_LDKEvent_ProbeFailed_get_short_channel_id(uint64_t ptr) {
4293         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4294         assert(obj->tag == LDKEvent_ProbeFailed);
4295                         uint64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
4296         return short_channel_id_ref;
4297 }
4298 int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable"))) TS_LDKEvent_PendingHTLCsForwardable_get_time_forwardable(uint64_t ptr) {
4299         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4300         assert(obj->tag == LDKEvent_PendingHTLCsForwardable);
4301                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
4302         return time_forwardable_conv;
4303 }
4304 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) {
4305         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4306         assert(obj->tag == LDKEvent_HTLCIntercepted);
4307                         int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__);
4308                         memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32);
4309         return intercept_id_arr;
4310 }
4311 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) {
4312         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4313         assert(obj->tag == LDKEvent_HTLCIntercepted);
4314                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
4315         return requested_next_hop_scid_conv;
4316 }
4317 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) {
4318         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4319         assert(obj->tag == LDKEvent_HTLCIntercepted);
4320                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
4321                         memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32);
4322         return payment_hash_arr;
4323 }
4324 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) {
4325         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4326         assert(obj->tag == LDKEvent_HTLCIntercepted);
4327                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
4328         return inbound_amount_msat_conv;
4329 }
4330 int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) {
4331         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4332         assert(obj->tag == LDKEvent_HTLCIntercepted);
4333                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
4334         return expected_outbound_amount_msat_conv;
4335 }
4336 uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) {
4337         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4338         assert(obj->tag == LDKEvent_SpendableOutputs);
4339                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4340                         uint64_tArray outputs_arr = NULL;
4341                         outputs_arr = init_uint64_tArray(outputs_var.datalen, __LINE__);
4342                         uint64_t *outputs_arr_ptr = (uint64_t*)(((uint8_t*)outputs_arr) + 8);
4343                         for (size_t b = 0; b < outputs_var.datalen; b++) {
4344                                 uint64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
4345                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
4346                         }
4347                         
4348         return outputs_arr;
4349 }
4350 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_prev_channel_id"))) TS_LDKEvent_PaymentForwarded_get_prev_channel_id(uint64_t ptr) {
4351         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4352         assert(obj->tag == LDKEvent_PaymentForwarded);
4353                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
4354                         memcpy(prev_channel_id_arr->elems, obj->payment_forwarded.prev_channel_id.data, 32);
4355         return prev_channel_id_arr;
4356 }
4357 int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_next_channel_id"))) TS_LDKEvent_PaymentForwarded_get_next_channel_id(uint64_t ptr) {
4358         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4359         assert(obj->tag == LDKEvent_PaymentForwarded);
4360                         int8_tArray next_channel_id_arr = init_int8_tArray(32, __LINE__);
4361                         memcpy(next_channel_id_arr->elems, obj->payment_forwarded.next_channel_id.data, 32);
4362         return next_channel_id_arr;
4363 }
4364 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_fee_earned_msat"))) TS_LDKEvent_PaymentForwarded_get_fee_earned_msat(uint64_t ptr) {
4365         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4366         assert(obj->tag == LDKEvent_PaymentForwarded);
4367                         uint64_t fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.fee_earned_msat, false);
4368         return fee_earned_msat_ref;
4369 }
4370 jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx"))) TS_LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(uint64_t ptr) {
4371         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4372         assert(obj->tag == LDKEvent_PaymentForwarded);
4373                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
4374         return claim_from_onchain_tx_conv;
4375 }
4376 uint64_t __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat"))) TS_LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(uint64_t ptr) {
4377         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4378         assert(obj->tag == LDKEvent_PaymentForwarded);
4379                         uint64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
4380         return outbound_amount_forwarded_msat_ref;
4381 }
4382 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_channel_id"))) TS_LDKEvent_ChannelPending_get_channel_id(uint64_t ptr) {
4383         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4384         assert(obj->tag == LDKEvent_ChannelPending);
4385                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
4386                         memcpy(channel_id_arr->elems, obj->channel_pending.channel_id.data, 32);
4387         return channel_id_arr;
4388 }
4389 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_user_channel_id"))) TS_LDKEvent_ChannelPending_get_user_channel_id(uint64_t ptr) {
4390         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4391         assert(obj->tag == LDKEvent_ChannelPending);
4392                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
4393                         memcpy(user_channel_id_arr->elems, obj->channel_pending.user_channel_id.le_bytes, 16);
4394         return user_channel_id_arr;
4395 }
4396 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_former_temporary_channel_id"))) TS_LDKEvent_ChannelPending_get_former_temporary_channel_id(uint64_t ptr) {
4397         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4398         assert(obj->tag == LDKEvent_ChannelPending);
4399                         int8_tArray former_temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
4400                         memcpy(former_temporary_channel_id_arr->elems, obj->channel_pending.former_temporary_channel_id.data, 32);
4401         return former_temporary_channel_id_arr;
4402 }
4403 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelPending_get_counterparty_node_id"))) TS_LDKEvent_ChannelPending_get_counterparty_node_id(uint64_t ptr) {
4404         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4405         assert(obj->tag == LDKEvent_ChannelPending);
4406                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
4407                         memcpy(counterparty_node_id_arr->elems, obj->channel_pending.counterparty_node_id.compressed_form, 33);
4408         return counterparty_node_id_arr;
4409 }
4410 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelPending_get_funding_txo"))) TS_LDKEvent_ChannelPending_get_funding_txo(uint64_t ptr) {
4411         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4412         assert(obj->tag == LDKEvent_ChannelPending);
4413                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
4414                         uint64_t funding_txo_ref = 0;
4415                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
4416                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
4417         return funding_txo_ref;
4418 }
4419 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) {
4420         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4421         assert(obj->tag == LDKEvent_ChannelReady);
4422                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
4423                         memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32);
4424         return channel_id_arr;
4425 }
4426 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) {
4427         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4428         assert(obj->tag == LDKEvent_ChannelReady);
4429                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
4430                         memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16);
4431         return user_channel_id_arr;
4432 }
4433 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) {
4434         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4435         assert(obj->tag == LDKEvent_ChannelReady);
4436                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
4437                         memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33);
4438         return counterparty_node_id_arr;
4439 }
4440 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) {
4441         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4442         assert(obj->tag == LDKEvent_ChannelReady);
4443                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
4444                         uint64_t channel_type_ref = 0;
4445                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
4446                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
4447         return channel_type_ref;
4448 }
4449 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) {
4450         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4451         assert(obj->tag == LDKEvent_ChannelClosed);
4452                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
4453                         memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32);
4454         return channel_id_arr;
4455 }
4456 int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) {
4457         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4458         assert(obj->tag == LDKEvent_ChannelClosed);
4459                         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
4460                         memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16);
4461         return user_channel_id_arr;
4462 }
4463 uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) {
4464         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4465         assert(obj->tag == LDKEvent_ChannelClosed);
4466                         uint64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
4467         return reason_ref;
4468 }
4469 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_channel_id"))) TS_LDKEvent_DiscardFunding_get_channel_id(uint64_t ptr) {
4470         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4471         assert(obj->tag == LDKEvent_DiscardFunding);
4472                         int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__);
4473                         memcpy(channel_id_arr->elems, obj->discard_funding.channel_id.data, 32);
4474         return channel_id_arr;
4475 }
4476 int8_tArray __attribute__((export_name("TS_LDKEvent_DiscardFunding_get_transaction"))) TS_LDKEvent_DiscardFunding_get_transaction(uint64_t ptr) {
4477         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4478         assert(obj->tag == LDKEvent_DiscardFunding);
4479                         LDKTransaction transaction_var = obj->discard_funding.transaction;
4480                         int8_tArray transaction_arr = init_int8_tArray(transaction_var.datalen, __LINE__);
4481                         memcpy(transaction_arr->elems, transaction_var.data, transaction_var.datalen);
4482         return transaction_arr;
4483 }
4484 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id"))) TS_LDKEvent_OpenChannelRequest_get_temporary_channel_id(uint64_t ptr) {
4485         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4486         assert(obj->tag == LDKEvent_OpenChannelRequest);
4487                         int8_tArray temporary_channel_id_arr = init_int8_tArray(32, __LINE__);
4488                         memcpy(temporary_channel_id_arr->elems, obj->open_channel_request.temporary_channel_id.data, 32);
4489         return temporary_channel_id_arr;
4490 }
4491 int8_tArray __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id"))) TS_LDKEvent_OpenChannelRequest_get_counterparty_node_id(uint64_t ptr) {
4492         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4493         assert(obj->tag == LDKEvent_OpenChannelRequest);
4494                         int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__);
4495                         memcpy(counterparty_node_id_arr->elems, obj->open_channel_request.counterparty_node_id.compressed_form, 33);
4496         return counterparty_node_id_arr;
4497 }
4498 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_funding_satoshis"))) TS_LDKEvent_OpenChannelRequest_get_funding_satoshis(uint64_t ptr) {
4499         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4500         assert(obj->tag == LDKEvent_OpenChannelRequest);
4501                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
4502         return funding_satoshis_conv;
4503 }
4504 int64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_push_msat"))) TS_LDKEvent_OpenChannelRequest_get_push_msat(uint64_t ptr) {
4505         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4506         assert(obj->tag == LDKEvent_OpenChannelRequest);
4507                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
4508         return push_msat_conv;
4509 }
4510 uint64_t __attribute__((export_name("TS_LDKEvent_OpenChannelRequest_get_channel_type"))) TS_LDKEvent_OpenChannelRequest_get_channel_type(uint64_t ptr) {
4511         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4512         assert(obj->tag == LDKEvent_OpenChannelRequest);
4513                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
4514                         uint64_t channel_type_ref = 0;
4515                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
4516                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
4517         return channel_type_ref;
4518 }
4519 int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id"))) TS_LDKEvent_HTLCHandlingFailed_get_prev_channel_id(uint64_t ptr) {
4520         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4521         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
4522                         int8_tArray prev_channel_id_arr = init_int8_tArray(32, __LINE__);
4523                         memcpy(prev_channel_id_arr->elems, obj->htlc_handling_failed.prev_channel_id.data, 32);
4524         return prev_channel_id_arr;
4525 }
4526 uint64_t __attribute__((export_name("TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination"))) TS_LDKEvent_HTLCHandlingFailed_get_failed_next_destination(uint64_t ptr) {
4527         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4528         assert(obj->tag == LDKEvent_HTLCHandlingFailed);
4529                         uint64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
4530         return failed_next_destination_ref;
4531 }
4532 uint64_t __attribute__((export_name("TS_LDKEvent_BumpTransaction_get_bump_transaction"))) TS_LDKEvent_BumpTransaction_get_bump_transaction(uint64_t ptr) {
4533         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
4534         assert(obj->tag == LDKEvent_BumpTransaction);
4535                         uint64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
4536         return bump_transaction_ref;
4537 }
4538 uint32_t __attribute__((export_name("TS_LDKCOption_EventZ_ty_from_ptr"))) TS_LDKCOption_EventZ_ty_from_ptr(uint64_t ptr) {
4539         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
4540         switch(obj->tag) {
4541                 case LDKCOption_EventZ_Some: return 0;
4542                 case LDKCOption_EventZ_None: return 1;
4543                 default: abort();
4544         }
4545 }
4546 uint64_t __attribute__((export_name("TS_LDKCOption_EventZ_Some_get_some"))) TS_LDKCOption_EventZ_Some_get_some(uint64_t ptr) {
4547         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
4548         assert(obj->tag == LDKCOption_EventZ_Some);
4549                         uint64_t some_ref = tag_ptr(&obj->some, false);
4550         return some_ref;
4551 }
4552 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
4553 CHECK(owner->result_ok);
4554         return COption_EventZ_clone(&*owner->contents.result);
4555 }
4556 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_ok"))) TS_CResult_COption_EventZDecodeErrorZ_get_ok(uint64_t owner) {
4557         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
4558         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
4559         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
4560         uint64_t ret_ref = tag_ptr(ret_copy, true);
4561         return ret_ref;
4562 }
4563
4564 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
4565 CHECK(!owner->result_ok);
4566         return DecodeError_clone(&*owner->contents.err);
4567 }
4568 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_get_err"))) TS_CResult_COption_EventZDecodeErrorZ_get_err(uint64_t owner) {
4569         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
4570         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4571         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
4572         uint64_t ret_ref = tag_ptr(ret_copy, true);
4573         return ret_ref;
4574 }
4575
4576 uint32_t __attribute__((export_name("TS_LDKErrorAction_ty_from_ptr"))) TS_LDKErrorAction_ty_from_ptr(uint64_t ptr) {
4577         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4578         switch(obj->tag) {
4579                 case LDKErrorAction_DisconnectPeer: return 0;
4580                 case LDKErrorAction_DisconnectPeerWithWarning: return 1;
4581                 case LDKErrorAction_IgnoreError: return 2;
4582                 case LDKErrorAction_IgnoreAndLog: return 3;
4583                 case LDKErrorAction_IgnoreDuplicateGossip: return 4;
4584                 case LDKErrorAction_SendErrorMessage: return 5;
4585                 case LDKErrorAction_SendWarningMessage: return 6;
4586                 default: abort();
4587         }
4588 }
4589 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeer_get_msg"))) TS_LDKErrorAction_DisconnectPeer_get_msg(uint64_t ptr) {
4590         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4591         assert(obj->tag == LDKErrorAction_DisconnectPeer);
4592                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
4593                         uint64_t msg_ref = 0;
4594                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4595                         msg_ref = tag_ptr(msg_var.inner, false);
4596         return msg_ref;
4597 }
4598 uint64_t __attribute__((export_name("TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg"))) TS_LDKErrorAction_DisconnectPeerWithWarning_get_msg(uint64_t ptr) {
4599         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4600         assert(obj->tag == LDKErrorAction_DisconnectPeerWithWarning);
4601                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
4602                         uint64_t msg_ref = 0;
4603                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4604                         msg_ref = tag_ptr(msg_var.inner, false);
4605         return msg_ref;
4606 }
4607 uint32_t __attribute__((export_name("TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log"))) TS_LDKErrorAction_IgnoreAndLog_get_ignore_and_log(uint64_t ptr) {
4608         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4609         assert(obj->tag == LDKErrorAction_IgnoreAndLog);
4610                         uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log);
4611         return ignore_and_log_conv;
4612 }
4613 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendErrorMessage_get_msg"))) TS_LDKErrorAction_SendErrorMessage_get_msg(uint64_t ptr) {
4614         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4615         assert(obj->tag == LDKErrorAction_SendErrorMessage);
4616                         LDKErrorMessage msg_var = obj->send_error_message.msg;
4617                         uint64_t msg_ref = 0;
4618                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4619                         msg_ref = tag_ptr(msg_var.inner, false);
4620         return msg_ref;
4621 }
4622 uint64_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_msg"))) TS_LDKErrorAction_SendWarningMessage_get_msg(uint64_t ptr) {
4623         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4624         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4625                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
4626                         uint64_t msg_ref = 0;
4627                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4628                         msg_ref = tag_ptr(msg_var.inner, false);
4629         return msg_ref;
4630 }
4631 uint32_t __attribute__((export_name("TS_LDKErrorAction_SendWarningMessage_get_log_level"))) TS_LDKErrorAction_SendWarningMessage_get_log_level(uint64_t ptr) {
4632         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
4633         assert(obj->tag == LDKErrorAction_SendWarningMessage);
4634                         uint32_t log_level_conv = LDKLevel_to_js(obj->send_warning_message.log_level);
4635         return log_level_conv;
4636 }
4637 uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_LDKMessageSendEvent_ty_from_ptr(uint64_t ptr) {
4638         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4639         switch(obj->tag) {
4640                 case LDKMessageSendEvent_SendAcceptChannel: return 0;
4641                 case LDKMessageSendEvent_SendAcceptChannelV2: return 1;
4642                 case LDKMessageSendEvent_SendOpenChannel: return 2;
4643                 case LDKMessageSendEvent_SendOpenChannelV2: return 3;
4644                 case LDKMessageSendEvent_SendFundingCreated: return 4;
4645                 case LDKMessageSendEvent_SendFundingSigned: return 5;
4646                 case LDKMessageSendEvent_SendTxAddInput: return 6;
4647                 case LDKMessageSendEvent_SendTxAddOutput: return 7;
4648                 case LDKMessageSendEvent_SendTxRemoveInput: return 8;
4649                 case LDKMessageSendEvent_SendTxRemoveOutput: return 9;
4650                 case LDKMessageSendEvent_SendTxComplete: return 10;
4651                 case LDKMessageSendEvent_SendTxSignatures: return 11;
4652                 case LDKMessageSendEvent_SendTxInitRbf: return 12;
4653                 case LDKMessageSendEvent_SendTxAckRbf: return 13;
4654                 case LDKMessageSendEvent_SendTxAbort: return 14;
4655                 case LDKMessageSendEvent_SendChannelReady: return 15;
4656                 case LDKMessageSendEvent_SendAnnouncementSignatures: return 16;
4657                 case LDKMessageSendEvent_UpdateHTLCs: return 17;
4658                 case LDKMessageSendEvent_SendRevokeAndACK: return 18;
4659                 case LDKMessageSendEvent_SendClosingSigned: return 19;
4660                 case LDKMessageSendEvent_SendShutdown: return 20;
4661                 case LDKMessageSendEvent_SendChannelReestablish: return 21;
4662                 case LDKMessageSendEvent_SendChannelAnnouncement: return 22;
4663                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 23;
4664                 case LDKMessageSendEvent_BroadcastChannelUpdate: return 24;
4665                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 25;
4666                 case LDKMessageSendEvent_SendChannelUpdate: return 26;
4667                 case LDKMessageSendEvent_HandleError: return 27;
4668                 case LDKMessageSendEvent_SendChannelRangeQuery: return 28;
4669                 case LDKMessageSendEvent_SendShortIdsQuery: return 29;
4670                 case LDKMessageSendEvent_SendReplyChannelRange: return 30;
4671                 case LDKMessageSendEvent_SendGossipTimestampFilter: return 31;
4672                 default: abort();
4673         }
4674 }
4675 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_node_id(uint64_t ptr) {
4676         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4677         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4678                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4679                         memcpy(node_id_arr->elems, obj->send_accept_channel.node_id.compressed_form, 33);
4680         return node_id_arr;
4681 }
4682 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannel_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannel_get_msg(uint64_t ptr) {
4683         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4684         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannel);
4685                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
4686                         uint64_t msg_ref = 0;
4687                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4688                         msg_ref = tag_ptr(msg_var.inner, false);
4689         return msg_ref;
4690 }
4691 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_node_id(uint64_t ptr) {
4692         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4693         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4694                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4695                         memcpy(node_id_arr->elems, obj->send_accept_channel_v2.node_id.compressed_form, 33);
4696         return node_id_arr;
4697 }
4698 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendAcceptChannelV2_get_msg(uint64_t ptr) {
4699         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4700         assert(obj->tag == LDKMessageSendEvent_SendAcceptChannelV2);
4701                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
4702                         uint64_t msg_ref = 0;
4703                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4704                         msg_ref = tag_ptr(msg_var.inner, false);
4705         return msg_ref;
4706 }
4707 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannel_get_node_id(uint64_t ptr) {
4708         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4709         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4710                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4711                         memcpy(node_id_arr->elems, obj->send_open_channel.node_id.compressed_form, 33);
4712         return node_id_arr;
4713 }
4714 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannel_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannel_get_msg(uint64_t ptr) {
4715         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4716         assert(obj->tag == LDKMessageSendEvent_SendOpenChannel);
4717                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
4718                         uint64_t msg_ref = 0;
4719                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4720                         msg_ref = tag_ptr(msg_var.inner, false);
4721         return msg_ref;
4722 }
4723 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_node_id(uint64_t ptr) {
4724         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4725         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4726                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4727                         memcpy(node_id_arr->elems, obj->send_open_channel_v2.node_id.compressed_form, 33);
4728         return node_id_arr;
4729 }
4730 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg"))) TS_LDKMessageSendEvent_SendOpenChannelV2_get_msg(uint64_t ptr) {
4731         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4732         assert(obj->tag == LDKMessageSendEvent_SendOpenChannelV2);
4733                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
4734                         uint64_t msg_ref = 0;
4735                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4736                         msg_ref = tag_ptr(msg_var.inner, false);
4737         return msg_ref;
4738 }
4739 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_node_id"))) TS_LDKMessageSendEvent_SendFundingCreated_get_node_id(uint64_t ptr) {
4740         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4741         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4742                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4743                         memcpy(node_id_arr->elems, obj->send_funding_created.node_id.compressed_form, 33);
4744         return node_id_arr;
4745 }
4746 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingCreated_get_msg"))) TS_LDKMessageSendEvent_SendFundingCreated_get_msg(uint64_t ptr) {
4747         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4748         assert(obj->tag == LDKMessageSendEvent_SendFundingCreated);
4749                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
4750                         uint64_t msg_ref = 0;
4751                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4752                         msg_ref = tag_ptr(msg_var.inner, false);
4753         return msg_ref;
4754 }
4755 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendFundingSigned_get_node_id(uint64_t ptr) {
4756         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4757         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4758                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4759                         memcpy(node_id_arr->elems, obj->send_funding_signed.node_id.compressed_form, 33);
4760         return node_id_arr;
4761 }
4762 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendFundingSigned_get_msg"))) TS_LDKMessageSendEvent_SendFundingSigned_get_msg(uint64_t ptr) {
4763         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4764         assert(obj->tag == LDKMessageSendEvent_SendFundingSigned);
4765                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
4766                         uint64_t msg_ref = 0;
4767                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4768                         msg_ref = tag_ptr(msg_var.inner, false);
4769         return msg_ref;
4770 }
4771 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddInput_get_node_id(uint64_t ptr) {
4772         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4773         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4774                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4775                         memcpy(node_id_arr->elems, obj->send_tx_add_input.node_id.compressed_form, 33);
4776         return node_id_arr;
4777 }
4778 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddInput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddInput_get_msg(uint64_t ptr) {
4779         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4780         assert(obj->tag == LDKMessageSendEvent_SendTxAddInput);
4781                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
4782                         uint64_t msg_ref = 0;
4783                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4784                         msg_ref = tag_ptr(msg_var.inner, false);
4785         return msg_ref;
4786 }
4787 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_node_id(uint64_t ptr) {
4788         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4789         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4790                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4791                         memcpy(node_id_arr->elems, obj->send_tx_add_output.node_id.compressed_form, 33);
4792         return node_id_arr;
4793 }
4794 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAddOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxAddOutput_get_msg(uint64_t ptr) {
4795         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4796         assert(obj->tag == LDKMessageSendEvent_SendTxAddOutput);
4797                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
4798                         uint64_t msg_ref = 0;
4799                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4800                         msg_ref = tag_ptr(msg_var.inner, false);
4801         return msg_ref;
4802 }
4803 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_node_id(uint64_t ptr) {
4804         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4805         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4806                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4807                         memcpy(node_id_arr->elems, obj->send_tx_remove_input.node_id.compressed_form, 33);
4808         return node_id_arr;
4809 }
4810 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveInput_get_msg(uint64_t ptr) {
4811         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4812         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveInput);
4813                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
4814                         uint64_t msg_ref = 0;
4815                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4816                         msg_ref = tag_ptr(msg_var.inner, false);
4817         return msg_ref;
4818 }
4819 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_node_id(uint64_t ptr) {
4820         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4821         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4822                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4823                         memcpy(node_id_arr->elems, obj->send_tx_remove_output.node_id.compressed_form, 33);
4824         return node_id_arr;
4825 }
4826 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg"))) TS_LDKMessageSendEvent_SendTxRemoveOutput_get_msg(uint64_t ptr) {
4827         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4828         assert(obj->tag == LDKMessageSendEvent_SendTxRemoveOutput);
4829                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
4830                         uint64_t msg_ref = 0;
4831                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4832                         msg_ref = tag_ptr(msg_var.inner, false);
4833         return msg_ref;
4834 }
4835 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_node_id"))) TS_LDKMessageSendEvent_SendTxComplete_get_node_id(uint64_t ptr) {
4836         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4837         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4838                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4839                         memcpy(node_id_arr->elems, obj->send_tx_complete.node_id.compressed_form, 33);
4840         return node_id_arr;
4841 }
4842 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxComplete_get_msg"))) TS_LDKMessageSendEvent_SendTxComplete_get_msg(uint64_t ptr) {
4843         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4844         assert(obj->tag == LDKMessageSendEvent_SendTxComplete);
4845                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
4846                         uint64_t msg_ref = 0;
4847                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4848                         msg_ref = tag_ptr(msg_var.inner, false);
4849         return msg_ref;
4850 }
4851 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendTxSignatures_get_node_id(uint64_t ptr) {
4852         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4853         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4854                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4855                         memcpy(node_id_arr->elems, obj->send_tx_signatures.node_id.compressed_form, 33);
4856         return node_id_arr;
4857 }
4858 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxSignatures_get_msg"))) TS_LDKMessageSendEvent_SendTxSignatures_get_msg(uint64_t ptr) {
4859         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4860         assert(obj->tag == LDKMessageSendEvent_SendTxSignatures);
4861                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
4862                         uint64_t msg_ref = 0;
4863                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4864                         msg_ref = tag_ptr(msg_var.inner, false);
4865         return msg_ref;
4866 }
4867 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_node_id(uint64_t ptr) {
4868         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4869         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4870                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4871                         memcpy(node_id_arr->elems, obj->send_tx_init_rbf.node_id.compressed_form, 33);
4872         return node_id_arr;
4873 }
4874 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxInitRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxInitRbf_get_msg(uint64_t ptr) {
4875         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4876         assert(obj->tag == LDKMessageSendEvent_SendTxInitRbf);
4877                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
4878                         uint64_t msg_ref = 0;
4879                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4880                         msg_ref = tag_ptr(msg_var.inner, false);
4881         return msg_ref;
4882 }
4883 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_node_id(uint64_t ptr) {
4884         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4885         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4886                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4887                         memcpy(node_id_arr->elems, obj->send_tx_ack_rbf.node_id.compressed_form, 33);
4888         return node_id_arr;
4889 }
4890 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAckRbf_get_msg"))) TS_LDKMessageSendEvent_SendTxAckRbf_get_msg(uint64_t ptr) {
4891         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4892         assert(obj->tag == LDKMessageSendEvent_SendTxAckRbf);
4893                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
4894                         uint64_t msg_ref = 0;
4895                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4896                         msg_ref = tag_ptr(msg_var.inner, false);
4897         return msg_ref;
4898 }
4899 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_node_id"))) TS_LDKMessageSendEvent_SendTxAbort_get_node_id(uint64_t ptr) {
4900         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4901         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4902                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4903                         memcpy(node_id_arr->elems, obj->send_tx_abort.node_id.compressed_form, 33);
4904         return node_id_arr;
4905 }
4906 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendTxAbort_get_msg"))) TS_LDKMessageSendEvent_SendTxAbort_get_msg(uint64_t ptr) {
4907         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4908         assert(obj->tag == LDKMessageSendEvent_SendTxAbort);
4909                         LDKTxAddInput msg_var = obj->send_tx_abort.msg;
4910                         uint64_t msg_ref = 0;
4911                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4912                         msg_ref = tag_ptr(msg_var.inner, false);
4913         return msg_ref;
4914 }
4915 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReady_get_node_id(uint64_t ptr) {
4916         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4917         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4918                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4919                         memcpy(node_id_arr->elems, obj->send_channel_ready.node_id.compressed_form, 33);
4920         return node_id_arr;
4921 }
4922 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReady_get_msg"))) TS_LDKMessageSendEvent_SendChannelReady_get_msg(uint64_t ptr) {
4923         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4924         assert(obj->tag == LDKMessageSendEvent_SendChannelReady);
4925                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
4926                         uint64_t msg_ref = 0;
4927                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4928                         msg_ref = tag_ptr(msg_var.inner, false);
4929         return msg_ref;
4930 }
4931 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_node_id(uint64_t ptr) {
4932         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4933         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4934                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4935                         memcpy(node_id_arr->elems, obj->send_announcement_signatures.node_id.compressed_form, 33);
4936         return node_id_arr;
4937 }
4938 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg"))) TS_LDKMessageSendEvent_SendAnnouncementSignatures_get_msg(uint64_t ptr) {
4939         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4940         assert(obj->tag == LDKMessageSendEvent_SendAnnouncementSignatures);
4941                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
4942                         uint64_t msg_ref = 0;
4943                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4944                         msg_ref = tag_ptr(msg_var.inner, false);
4945         return msg_ref;
4946 }
4947 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_node_id(uint64_t ptr) {
4948         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4949         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4950                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4951                         memcpy(node_id_arr->elems, obj->update_htl_cs.node_id.compressed_form, 33);
4952         return node_id_arr;
4953 }
4954 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_UpdateHTLCs_get_updates"))) TS_LDKMessageSendEvent_UpdateHTLCs_get_updates(uint64_t ptr) {
4955         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4956         assert(obj->tag == LDKMessageSendEvent_UpdateHTLCs);
4957                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
4958                         uint64_t updates_ref = 0;
4959                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
4960                         updates_ref = tag_ptr(updates_var.inner, false);
4961         return updates_ref;
4962 }
4963 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_node_id(uint64_t ptr) {
4964         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4965         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4966                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4967                         memcpy(node_id_arr->elems, obj->send_revoke_and_ack.node_id.compressed_form, 33);
4968         return node_id_arr;
4969 }
4970 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg"))) TS_LDKMessageSendEvent_SendRevokeAndACK_get_msg(uint64_t ptr) {
4971         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4972         assert(obj->tag == LDKMessageSendEvent_SendRevokeAndACK);
4973                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
4974                         uint64_t msg_ref = 0;
4975                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4976                         msg_ref = tag_ptr(msg_var.inner, false);
4977         return msg_ref;
4978 }
4979 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_node_id"))) TS_LDKMessageSendEvent_SendClosingSigned_get_node_id(uint64_t ptr) {
4980         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4981         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4982                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4983                         memcpy(node_id_arr->elems, obj->send_closing_signed.node_id.compressed_form, 33);
4984         return node_id_arr;
4985 }
4986 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendClosingSigned_get_msg"))) TS_LDKMessageSendEvent_SendClosingSigned_get_msg(uint64_t ptr) {
4987         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4988         assert(obj->tag == LDKMessageSendEvent_SendClosingSigned);
4989                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
4990                         uint64_t msg_ref = 0;
4991                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
4992                         msg_ref = tag_ptr(msg_var.inner, false);
4993         return msg_ref;
4994 }
4995 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_node_id"))) TS_LDKMessageSendEvent_SendShutdown_get_node_id(uint64_t ptr) {
4996         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
4997         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
4998                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
4999                         memcpy(node_id_arr->elems, obj->send_shutdown.node_id.compressed_form, 33);
5000         return node_id_arr;
5001 }
5002 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShutdown_get_msg"))) TS_LDKMessageSendEvent_SendShutdown_get_msg(uint64_t ptr) {
5003         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5004         assert(obj->tag == LDKMessageSendEvent_SendShutdown);
5005                         LDKShutdown msg_var = obj->send_shutdown.msg;
5006                         uint64_t msg_ref = 0;
5007                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5008                         msg_ref = tag_ptr(msg_var.inner, false);
5009         return msg_ref;
5010 }
5011 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_node_id(uint64_t ptr) {
5012         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5013         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
5014                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5015                         memcpy(node_id_arr->elems, obj->send_channel_reestablish.node_id.compressed_form, 33);
5016         return node_id_arr;
5017 }
5018 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelReestablish_get_msg"))) TS_LDKMessageSendEvent_SendChannelReestablish_get_msg(uint64_t ptr) {
5019         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5020         assert(obj->tag == LDKMessageSendEvent_SendChannelReestablish);
5021                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
5022                         uint64_t msg_ref = 0;
5023                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5024                         msg_ref = tag_ptr(msg_var.inner, false);
5025         return msg_ref;
5026 }
5027 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_node_id(uint64_t ptr) {
5028         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5029         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5030                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5031                         memcpy(node_id_arr->elems, obj->send_channel_announcement.node_id.compressed_form, 33);
5032         return node_id_arr;
5033 }
5034 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_msg(uint64_t ptr) {
5035         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5036         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5037                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
5038                         uint64_t msg_ref = 0;
5039                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5040                         msg_ref = tag_ptr(msg_var.inner, false);
5041         return msg_ref;
5042 }
5043 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_SendChannelAnnouncement_get_update_msg(uint64_t ptr) {
5044         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5045         assert(obj->tag == LDKMessageSendEvent_SendChannelAnnouncement);
5046                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
5047                         uint64_t update_msg_ref = 0;
5048                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
5049                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
5050         return update_msg_ref;
5051 }
5052 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_msg(uint64_t ptr) {
5053         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5054         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
5055                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
5056                         uint64_t msg_ref = 0;
5057                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5058                         msg_ref = tag_ptr(msg_var.inner, false);
5059         return msg_ref;
5060 }
5061 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg"))) TS_LDKMessageSendEvent_BroadcastChannelAnnouncement_get_update_msg(uint64_t ptr) {
5062         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5063         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelAnnouncement);
5064                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
5065                         uint64_t update_msg_ref = 0;
5066                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
5067                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
5068         return update_msg_ref;
5069 }
5070 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_BroadcastChannelUpdate_get_msg(uint64_t ptr) {
5071         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5072         assert(obj->tag == LDKMessageSendEvent_BroadcastChannelUpdate);
5073                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
5074                         uint64_t msg_ref = 0;
5075                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5076                         msg_ref = tag_ptr(msg_var.inner, false);
5077         return msg_ref;
5078 }
5079 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) {
5080         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5081         assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement);
5082                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
5083                         uint64_t msg_ref = 0;
5084                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5085                         msg_ref = tag_ptr(msg_var.inner, false);
5086         return msg_ref;
5087 }
5088 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) {
5089         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5090         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
5091                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5092                         memcpy(node_id_arr->elems, obj->send_channel_update.node_id.compressed_form, 33);
5093         return node_id_arr;
5094 }
5095 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_msg"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_msg(uint64_t ptr) {
5096         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5097         assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate);
5098                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
5099                         uint64_t msg_ref = 0;
5100                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5101                         msg_ref = tag_ptr(msg_var.inner, false);
5102         return msg_ref;
5103 }
5104 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_node_id"))) TS_LDKMessageSendEvent_HandleError_get_node_id(uint64_t ptr) {
5105         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5106         assert(obj->tag == LDKMessageSendEvent_HandleError);
5107                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5108                         memcpy(node_id_arr->elems, obj->handle_error.node_id.compressed_form, 33);
5109         return node_id_arr;
5110 }
5111 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_HandleError_get_action"))) TS_LDKMessageSendEvent_HandleError_get_action(uint64_t ptr) {
5112         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5113         assert(obj->tag == LDKMessageSendEvent_HandleError);
5114                         uint64_t action_ref = tag_ptr(&obj->handle_error.action, false);
5115         return action_ref;
5116 }
5117 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_node_id(uint64_t ptr) {
5118         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5119         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
5120                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5121                         memcpy(node_id_arr->elems, obj->send_channel_range_query.node_id.compressed_form, 33);
5122         return node_id_arr;
5123 }
5124 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg"))) TS_LDKMessageSendEvent_SendChannelRangeQuery_get_msg(uint64_t ptr) {
5125         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5126         assert(obj->tag == LDKMessageSendEvent_SendChannelRangeQuery);
5127                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
5128                         uint64_t msg_ref = 0;
5129                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5130                         msg_ref = tag_ptr(msg_var.inner, false);
5131         return msg_ref;
5132 }
5133 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_node_id(uint64_t ptr) {
5134         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5135         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
5136                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5137                         memcpy(node_id_arr->elems, obj->send_short_ids_query.node_id.compressed_form, 33);
5138         return node_id_arr;
5139 }
5140 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg"))) TS_LDKMessageSendEvent_SendShortIdsQuery_get_msg(uint64_t ptr) {
5141         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5142         assert(obj->tag == LDKMessageSendEvent_SendShortIdsQuery);
5143                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
5144                         uint64_t msg_ref = 0;
5145                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5146                         msg_ref = tag_ptr(msg_var.inner, false);
5147         return msg_ref;
5148 }
5149 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_node_id(uint64_t ptr) {
5150         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5151         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
5152                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5153                         memcpy(node_id_arr->elems, obj->send_reply_channel_range.node_id.compressed_form, 33);
5154         return node_id_arr;
5155 }
5156 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg"))) TS_LDKMessageSendEvent_SendReplyChannelRange_get_msg(uint64_t ptr) {
5157         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5158         assert(obj->tag == LDKMessageSendEvent_SendReplyChannelRange);
5159                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
5160                         uint64_t msg_ref = 0;
5161                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5162                         msg_ref = tag_ptr(msg_var.inner, false);
5163         return msg_ref;
5164 }
5165 int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_node_id(uint64_t ptr) {
5166         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5167         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
5168                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
5169                         memcpy(node_id_arr->elems, obj->send_gossip_timestamp_filter.node_id.compressed_form, 33);
5170         return node_id_arr;
5171 }
5172 uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg"))) TS_LDKMessageSendEvent_SendGossipTimestampFilter_get_msg(uint64_t ptr) {
5173         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
5174         assert(obj->tag == LDKMessageSendEvent_SendGossipTimestampFilter);
5175                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
5176                         uint64_t msg_ref = 0;
5177                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
5178                         msg_ref = tag_ptr(msg_var.inner, false);
5179         return msg_ref;
5180 }
5181 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
5182         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
5183         for (size_t i = 0; i < ret.datalen; i++) {
5184                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
5185         }
5186         return ret;
5187 }
5188 static inline LDKCVec_ChainHashZ CVec_ChainHashZ_clone(const LDKCVec_ChainHashZ *orig) {
5189         LDKCVec_ChainHashZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ChainHashZ clone bytes"), .datalen = orig->datalen };
5190         for (size_t i = 0; i < ret.datalen; i++) {
5191                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
5192         }
5193         return ret;
5194 }
5195 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5196         LDKOffer ret = *owner->contents.result;
5197         ret.is_owned = false;
5198         return ret;
5199 }
5200 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_ok"))) TS_CResult_OfferBolt12ParseErrorZ_get_ok(uint64_t owner) {
5201         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5202         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
5203         uint64_t ret_ref = 0;
5204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5206         return ret_ref;
5207 }
5208
5209 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
5210         LDKBolt12ParseError ret = *owner->contents.err;
5211         ret.is_owned = false;
5212         return ret;
5213 }
5214 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_get_err"))) TS_CResult_OfferBolt12ParseErrorZ_get_err(uint64_t owner) {
5215         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
5216         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
5217         uint64_t ret_ref = 0;
5218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5220         return ret_ref;
5221 }
5222
5223 static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5224 CHECK(owner->result_ok);
5225         return *owner->contents.result;
5226 }
5227 int8_tArray  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) {
5228         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5229         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
5230         memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33);
5231         return ret_arr;
5232 }
5233
5234 static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){
5235 CHECK(!owner->result_ok);
5236         return *owner->contents.err;
5237 }
5238 uint32_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) {
5239         LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner);
5240         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv));
5241         return ret_conv;
5242 }
5243
5244 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5245         LDKNodeId ret = *owner->contents.result;
5246         ret.is_owned = false;
5247         return ret;
5248 }
5249 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_ok"))) TS_CResult_NodeIdDecodeErrorZ_get_ok(uint64_t owner) {
5250         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5251         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
5252         uint64_t ret_ref = 0;
5253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5255         return ret_ref;
5256 }
5257
5258 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
5259 CHECK(!owner->result_ok);
5260         return DecodeError_clone(&*owner->contents.err);
5261 }
5262 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_get_err"))) TS_CResult_NodeIdDecodeErrorZ_get_err(uint64_t owner) {
5263         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
5264         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5265         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
5266         uint64_t ret_ref = tag_ptr(ret_copy, true);
5267         return ret_ref;
5268 }
5269
5270 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5271 CHECK(owner->result_ok);
5272         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
5273 }
5274 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(uint64_t owner) {
5275         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5276         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
5277         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
5278         uint64_t ret_ref = tag_ptr(ret_copy, true);
5279         return ret_ref;
5280 }
5281
5282 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
5283 CHECK(!owner->result_ok);
5284         return DecodeError_clone(&*owner->contents.err);
5285 }
5286 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(uint64_t owner) {
5287         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
5288         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5289         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
5290         uint64_t ret_ref = tag_ptr(ret_copy, true);
5291         return ret_ref;
5292 }
5293
5294 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5295 CHECK(owner->result_ok);
5296         return TxOut_clone(&*owner->contents.result);
5297 }
5298 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) {
5299         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5300         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5301         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
5302         return tag_ptr(ret_ref, true);
5303 }
5304
5305 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
5306 CHECK(!owner->result_ok);
5307         return UtxoLookupError_clone(&*owner->contents.err);
5308 }
5309 uint32_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) {
5310         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
5311         uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
5312         return ret_conv;
5313 }
5314
5315 uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) {
5316         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5317         switch(obj->tag) {
5318                 case LDKUtxoResult_Sync: return 0;
5319                 case LDKUtxoResult_Async: return 1;
5320                 default: abort();
5321         }
5322 }
5323 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) {
5324         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5325         assert(obj->tag == LDKUtxoResult_Sync);
5326                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
5327                         *sync_conv = obj->sync;
5328                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
5329         return tag_ptr(sync_conv, true);
5330 }
5331 uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) {
5332         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
5333         assert(obj->tag == LDKUtxoResult_Async);
5334                         LDKUtxoFuture async_var = obj->async;
5335                         uint64_t async_ref = 0;
5336                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
5337                         async_ref = tag_ptr(async_var.inner, false);
5338         return async_ref;
5339 }
5340 typedef struct LDKUtxoLookup_JCalls {
5341         atomic_size_t refcnt;
5342         uint32_t instance_ptr;
5343 } LDKUtxoLookup_JCalls;
5344 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
5345         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5346         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5347                 FREE(j_calls);
5348         }
5349 }
5350 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
5351         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
5352         int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__);
5353         memcpy(genesis_hash_arr->elems, *genesis_hash, 32);
5354         int64_t short_channel_id_conv = short_channel_id;
5355         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);
5356         void* ret_ptr = untag_ptr(ret);
5357         CHECK_ACCESS(ret_ptr);
5358         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
5359         FREE(untag_ptr(ret));
5360         return ret_conv;
5361 }
5362 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
5363         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
5364         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5365 }
5366 static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) {
5367         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
5368         atomic_init(&calls->refcnt, 1);
5369         calls->instance_ptr = o;
5370
5371         LDKUtxoLookup ret = {
5372                 .this_arg = (void*) calls,
5373                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
5374                 .free = LDKUtxoLookup_JCalls_free,
5375         };
5376         return ret;
5377 }
5378 uint64_t  __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) {
5379         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5380         *res_ptr = LDKUtxoLookup_init(o);
5381         return tag_ptr(res_ptr, true);
5382 }
5383 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) {
5384         void* this_arg_ptr = untag_ptr(this_arg);
5385         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
5386         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
5387         uint8_t genesis_hash_arr[32];
5388         CHECK(genesis_hash->arr_len == 32);
5389         memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash);
5390         uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr;
5391         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
5392         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
5393         uint64_t ret_ref = tag_ptr(ret_copy, true);
5394         return ret_ref;
5395 }
5396
5397 uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) {
5398         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5399         switch(obj->tag) {
5400                 case LDKCOption_UtxoLookupZ_Some: return 0;
5401                 case LDKCOption_UtxoLookupZ_None: return 1;
5402                 default: abort();
5403         }
5404 }
5405 uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) {
5406         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
5407         assert(obj->tag == LDKCOption_UtxoLookupZ_Some);
5408                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
5409                         *some_ret = obj->some;
5410                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
5411                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
5412                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5413                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
5414                         }
5415         return tag_ptr(some_ret, true);
5416 }
5417 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5418 CHECK(owner->result_ok);
5419         return *owner->contents.result;
5420 }
5421 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_ok"))) TS_CResult_NoneLightningErrorZ_get_ok(uint64_t owner) {
5422         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5423         CResult_NoneLightningErrorZ_get_ok(owner_conv);
5424 }
5425
5426 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
5427         LDKLightningError ret = *owner->contents.err;
5428         ret.is_owned = false;
5429         return ret;
5430 }
5431 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_get_err"))) TS_CResult_NoneLightningErrorZ_get_err(uint64_t owner) {
5432         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
5433         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
5434         uint64_t ret_ref = 0;
5435         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5436         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5437         return ret_ref;
5438 }
5439
5440 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5441 CHECK(owner->result_ok);
5442         return *owner->contents.result;
5443 }
5444 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_ok"))) TS_CResult_boolLightningErrorZ_get_ok(uint64_t owner) {
5445         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5446         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
5447         return ret_conv;
5448 }
5449
5450 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
5451         LDKLightningError ret = *owner->contents.err;
5452         ret.is_owned = false;
5453         return ret;
5454 }
5455 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_get_err"))) TS_CResult_boolLightningErrorZ_get_err(uint64_t owner) {
5456         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
5457         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
5458         uint64_t ret_ref = 0;
5459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5461         return ret_ref;
5462 }
5463
5464 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5465         LDKChannelAnnouncement ret = owner->a;
5466         ret.is_owned = false;
5467         return ret;
5468 }
5469 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(uint64_t owner) {
5470         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5471         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
5472         uint64_t ret_ref = 0;
5473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5475         return ret_ref;
5476 }
5477
5478 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5479         LDKChannelUpdate ret = owner->b;
5480         ret.is_owned = false;
5481         return ret;
5482 }
5483 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(uint64_t owner) {
5484         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5485         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
5486         uint64_t ret_ref = 0;
5487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5489         return ret_ref;
5490 }
5491
5492 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
5493         LDKChannelUpdate ret = owner->c;
5494         ret.is_owned = false;
5495         return ret;
5496 }
5497 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(uint64_t owner) {
5498         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
5499         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
5500         uint64_t ret_ref = 0;
5501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5503         return ret_ref;
5504 }
5505
5506 uint32_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_ty_from_ptr(uint64_t ptr) {
5507         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5508         switch(obj->tag) {
5509                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: return 0;
5510                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: return 1;
5511                 default: abort();
5512         }
5513 }
5514 uint64_t __attribute__((export_name("TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some"))) TS_LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_get_some(uint64_t ptr) {
5515         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
5516         assert(obj->tag == LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some);
5517                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5518                         *some_conv = obj->some;
5519                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
5520         return tag_ptr(some_conv, true);
5521 }
5522 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5523         LDKChannelUpdateInfo ret = *owner->contents.result;
5524         ret.is_owned = false;
5525         return ret;
5526 }
5527 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(uint64_t owner) {
5528         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5529         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
5530         uint64_t ret_ref = 0;
5531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5533         return ret_ref;
5534 }
5535
5536 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
5537 CHECK(!owner->result_ok);
5538         return DecodeError_clone(&*owner->contents.err);
5539 }
5540 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_get_err(uint64_t owner) {
5541         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
5542         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5543         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
5544         uint64_t ret_ref = tag_ptr(ret_copy, true);
5545         return ret_ref;
5546 }
5547
5548 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5549         LDKChannelInfo ret = *owner->contents.result;
5550         ret.is_owned = false;
5551         return ret;
5552 }
5553 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_get_ok(uint64_t owner) {
5554         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5555         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
5556         uint64_t ret_ref = 0;
5557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5559         return ret_ref;
5560 }
5561
5562 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
5563 CHECK(!owner->result_ok);
5564         return DecodeError_clone(&*owner->contents.err);
5565 }
5566 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_get_err"))) TS_CResult_ChannelInfoDecodeErrorZ_get_err(uint64_t owner) {
5567         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
5568         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5569         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
5570         uint64_t ret_ref = tag_ptr(ret_copy, true);
5571         return ret_ref;
5572 }
5573
5574 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5575         LDKRoutingFees ret = *owner->contents.result;
5576         ret.is_owned = false;
5577         return ret;
5578 }
5579 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_get_ok(uint64_t owner) {
5580         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5581         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
5582         uint64_t ret_ref = 0;
5583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5585         return ret_ref;
5586 }
5587
5588 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
5589 CHECK(!owner->result_ok);
5590         return DecodeError_clone(&*owner->contents.err);
5591 }
5592 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_get_err"))) TS_CResult_RoutingFeesDecodeErrorZ_get_err(uint64_t owner) {
5593         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
5594         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5595         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
5596         uint64_t ret_ref = tag_ptr(ret_copy, true);
5597         return ret_ref;
5598 }
5599
5600 uint32_t __attribute__((export_name("TS_LDKNetAddress_ty_from_ptr"))) TS_LDKNetAddress_ty_from_ptr(uint64_t ptr) {
5601         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5602         switch(obj->tag) {
5603                 case LDKNetAddress_IPv4: return 0;
5604                 case LDKNetAddress_IPv6: return 1;
5605                 case LDKNetAddress_OnionV2: return 2;
5606                 case LDKNetAddress_OnionV3: return 3;
5607                 case LDKNetAddress_Hostname: return 4;
5608                 default: abort();
5609         }
5610 }
5611 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv4_get_addr"))) TS_LDKNetAddress_IPv4_get_addr(uint64_t ptr) {
5612         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5613         assert(obj->tag == LDKNetAddress_IPv4);
5614                         int8_tArray addr_arr = init_int8_tArray(4, __LINE__);
5615                         memcpy(addr_arr->elems, obj->i_pv4.addr.data, 4);
5616         return addr_arr;
5617 }
5618 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv4_get_port"))) TS_LDKNetAddress_IPv4_get_port(uint64_t ptr) {
5619         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5620         assert(obj->tag == LDKNetAddress_IPv4);
5621                         int16_t port_conv = obj->i_pv4.port;
5622         return port_conv;
5623 }
5624 int8_tArray __attribute__((export_name("TS_LDKNetAddress_IPv6_get_addr"))) TS_LDKNetAddress_IPv6_get_addr(uint64_t ptr) {
5625         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5626         assert(obj->tag == LDKNetAddress_IPv6);
5627                         int8_tArray addr_arr = init_int8_tArray(16, __LINE__);
5628                         memcpy(addr_arr->elems, obj->i_pv6.addr.data, 16);
5629         return addr_arr;
5630 }
5631 int16_t __attribute__((export_name("TS_LDKNetAddress_IPv6_get_port"))) TS_LDKNetAddress_IPv6_get_port(uint64_t ptr) {
5632         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5633         assert(obj->tag == LDKNetAddress_IPv6);
5634                         int16_t port_conv = obj->i_pv6.port;
5635         return port_conv;
5636 }
5637 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV2_get_onion_v2"))) TS_LDKNetAddress_OnionV2_get_onion_v2(uint64_t ptr) {
5638         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5639         assert(obj->tag == LDKNetAddress_OnionV2);
5640                         int8_tArray onion_v2_arr = init_int8_tArray(12, __LINE__);
5641                         memcpy(onion_v2_arr->elems, obj->onion_v2.data, 12);
5642         return onion_v2_arr;
5643 }
5644 int8_tArray __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_ed25519_pubkey"))) TS_LDKNetAddress_OnionV3_get_ed25519_pubkey(uint64_t ptr) {
5645         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5646         assert(obj->tag == LDKNetAddress_OnionV3);
5647                         int8_tArray ed25519_pubkey_arr = init_int8_tArray(32, __LINE__);
5648                         memcpy(ed25519_pubkey_arr->elems, obj->onion_v3.ed25519_pubkey.data, 32);
5649         return ed25519_pubkey_arr;
5650 }
5651 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_checksum"))) TS_LDKNetAddress_OnionV3_get_checksum(uint64_t ptr) {
5652         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5653         assert(obj->tag == LDKNetAddress_OnionV3);
5654                         int16_t checksum_conv = obj->onion_v3.checksum;
5655         return checksum_conv;
5656 }
5657 int8_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_version"))) TS_LDKNetAddress_OnionV3_get_version(uint64_t ptr) {
5658         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5659         assert(obj->tag == LDKNetAddress_OnionV3);
5660                         int8_t version_conv = obj->onion_v3.version;
5661         return version_conv;
5662 }
5663 int16_t __attribute__((export_name("TS_LDKNetAddress_OnionV3_get_port"))) TS_LDKNetAddress_OnionV3_get_port(uint64_t ptr) {
5664         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5665         assert(obj->tag == LDKNetAddress_OnionV3);
5666                         int16_t port_conv = obj->onion_v3.port;
5667         return port_conv;
5668 }
5669 uint64_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_hostname"))) TS_LDKNetAddress_Hostname_get_hostname(uint64_t ptr) {
5670         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5671         assert(obj->tag == LDKNetAddress_Hostname);
5672                         LDKHostname hostname_var = obj->hostname.hostname;
5673                         uint64_t hostname_ref = 0;
5674                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
5675                         hostname_ref = tag_ptr(hostname_var.inner, false);
5676         return hostname_ref;
5677 }
5678 int16_t __attribute__((export_name("TS_LDKNetAddress_Hostname_get_port"))) TS_LDKNetAddress_Hostname_get_port(uint64_t ptr) {
5679         LDKNetAddress *obj = (LDKNetAddress*)untag_ptr(ptr);
5680         assert(obj->tag == LDKNetAddress_Hostname);
5681                         int16_t port_conv = obj->hostname.port;
5682         return port_conv;
5683 }
5684 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
5685         LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
5686         for (size_t i = 0; i < ret.datalen; i++) {
5687                 ret.data[i] = NetAddress_clone(&orig->data[i]);
5688         }
5689         return ret;
5690 }
5691 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5692         LDKNodeAnnouncementInfo ret = *owner->contents.result;
5693         ret.is_owned = false;
5694         return ret;
5695 }
5696 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(uint64_t owner) {
5697         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5698         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
5699         uint64_t ret_ref = 0;
5700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5702         return ret_ref;
5703 }
5704
5705 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
5706 CHECK(!owner->result_ok);
5707         return DecodeError_clone(&*owner->contents.err);
5708 }
5709 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(uint64_t owner) {
5710         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
5711         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5712         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
5713         uint64_t ret_ref = tag_ptr(ret_copy, true);
5714         return ret_ref;
5715 }
5716
5717 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5718         LDKNodeAlias ret = *owner->contents.result;
5719         ret.is_owned = false;
5720         return ret;
5721 }
5722 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_ok"))) TS_CResult_NodeAliasDecodeErrorZ_get_ok(uint64_t owner) {
5723         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5724         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
5725         uint64_t ret_ref = 0;
5726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5728         return ret_ref;
5729 }
5730
5731 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
5732 CHECK(!owner->result_ok);
5733         return DecodeError_clone(&*owner->contents.err);
5734 }
5735 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_get_err"))) TS_CResult_NodeAliasDecodeErrorZ_get_err(uint64_t owner) {
5736         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
5737         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5738         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
5739         uint64_t ret_ref = tag_ptr(ret_copy, true);
5740         return ret_ref;
5741 }
5742
5743 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5744         LDKNodeInfo ret = *owner->contents.result;
5745         ret.is_owned = false;
5746         return ret;
5747 }
5748 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_ok"))) TS_CResult_NodeInfoDecodeErrorZ_get_ok(uint64_t owner) {
5749         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5750         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
5751         uint64_t ret_ref = 0;
5752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5754         return ret_ref;
5755 }
5756
5757 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
5758 CHECK(!owner->result_ok);
5759         return DecodeError_clone(&*owner->contents.err);
5760 }
5761 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_get_err"))) TS_CResult_NodeInfoDecodeErrorZ_get_err(uint64_t owner) {
5762         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
5763         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5764         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
5765         uint64_t ret_ref = tag_ptr(ret_copy, true);
5766         return ret_ref;
5767 }
5768
5769 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5770         LDKNetworkGraph ret = *owner->contents.result;
5771         ret.is_owned = false;
5772         return ret;
5773 }
5774 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_get_ok(uint64_t owner) {
5775         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5776         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
5777         uint64_t ret_ref = 0;
5778         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5779         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5780         return ret_ref;
5781 }
5782
5783 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
5784 CHECK(!owner->result_ok);
5785         return DecodeError_clone(&*owner->contents.err);
5786 }
5787 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_get_err"))) TS_CResult_NetworkGraphDecodeErrorZ_get_err(uint64_t owner) {
5788         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
5789         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5790         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
5791         uint64_t ret_ref = tag_ptr(ret_copy, true);
5792         return ret_ref;
5793 }
5794
5795 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr"))) TS_LDKCOption_CVec_NetAddressZZ_ty_from_ptr(uint64_t ptr) {
5796         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
5797         switch(obj->tag) {
5798                 case LDKCOption_CVec_NetAddressZZ_Some: return 0;
5799                 case LDKCOption_CVec_NetAddressZZ_None: return 1;
5800                 default: abort();
5801         }
5802 }
5803 uint64_tArray __attribute__((export_name("TS_LDKCOption_CVec_NetAddressZZ_Some_get_some"))) TS_LDKCOption_CVec_NetAddressZZ_Some_get_some(uint64_t ptr) {
5804         LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(ptr);
5805         assert(obj->tag == LDKCOption_CVec_NetAddressZZ_Some);
5806                         LDKCVec_NetAddressZ some_var = obj->some;
5807                         uint64_tArray some_arr = NULL;
5808                         some_arr = init_uint64_tArray(some_var.datalen, __LINE__);
5809                         uint64_t *some_arr_ptr = (uint64_t*)(((uint8_t*)some_arr) + 8);
5810                         for (size_t m = 0; m < some_var.datalen; m++) {
5811                                 uint64_t some_conv_12_ref = tag_ptr(&some_var.data[m], false);
5812                                 some_arr_ptr[m] = some_conv_12_ref;
5813                         }
5814                         
5815         return some_arr;
5816 }
5817 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
5818         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
5819         for (size_t i = 0; i < ret.datalen; i++) {
5820                 ret.data[i] = Utxo_clone(&orig->data[i]);
5821         }
5822         return ret;
5823 }
5824 uint32_t __attribute__((export_name("TS_LDKCOption_TxOutZ_ty_from_ptr"))) TS_LDKCOption_TxOutZ_ty_from_ptr(uint64_t ptr) {
5825         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5826         switch(obj->tag) {
5827                 case LDKCOption_TxOutZ_Some: return 0;
5828                 case LDKCOption_TxOutZ_None: return 1;
5829                 default: abort();
5830         }
5831 }
5832 uint64_t __attribute__((export_name("TS_LDKCOption_TxOutZ_Some_get_some"))) TS_LDKCOption_TxOutZ_Some_get_some(uint64_t ptr) {
5833         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
5834         assert(obj->tag == LDKCOption_TxOutZ_Some);
5835                         LDKTxOut* some_ref = &obj->some;
5836         return tag_ptr(some_ref, false);
5837 }
5838 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
5839         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
5840         for (size_t i = 0; i < ret.datalen; i++) {
5841                 ret.data[i] = Input_clone(&orig->data[i]);
5842         }
5843         return ret;
5844 }
5845 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5846         LDKCoinSelection ret = *owner->contents.result;
5847         ret.is_owned = false;
5848         return ret;
5849 }
5850 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_ok"))) TS_CResult_CoinSelectionNoneZ_get_ok(uint64_t owner) {
5851         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5852         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
5853         uint64_t ret_ref = 0;
5854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5856         return ret_ref;
5857 }
5858
5859 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
5860 CHECK(!owner->result_ok);
5861         return *owner->contents.err;
5862 }
5863 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_get_err"))) TS_CResult_CoinSelectionNoneZ_get_err(uint64_t owner) {
5864         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
5865         CResult_CoinSelectionNoneZ_get_err(owner_conv);
5866 }
5867
5868 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5869 CHECK(owner->result_ok);
5870         return CVec_UtxoZ_clone(&*owner->contents.result);
5871 }
5872 uint64_tArray  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_ok"))) TS_CResult_CVec_UtxoZNoneZ_get_ok(uint64_t owner) {
5873         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5874         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
5875         uint64_tArray ret_arr = NULL;
5876         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
5877         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
5878         for (size_t g = 0; g < ret_var.datalen; g++) {
5879                 LDKUtxo ret_conv_6_var = ret_var.data[g];
5880                 uint64_t ret_conv_6_ref = 0;
5881                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
5882                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
5883                 ret_arr_ptr[g] = ret_conv_6_ref;
5884         }
5885         
5886         FREE(ret_var.data);
5887         return ret_arr;
5888 }
5889
5890 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
5891 CHECK(!owner->result_ok);
5892         return *owner->contents.err;
5893 }
5894 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_get_err"))) TS_CResult_CVec_UtxoZNoneZ_get_err(uint64_t owner) {
5895         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
5896         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
5897 }
5898
5899 uint32_t __attribute__((export_name("TS_LDKCOption_u16Z_ty_from_ptr"))) TS_LDKCOption_u16Z_ty_from_ptr(uint64_t ptr) {
5900         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
5901         switch(obj->tag) {
5902                 case LDKCOption_u16Z_Some: return 0;
5903                 case LDKCOption_u16Z_None: return 1;
5904                 default: abort();
5905         }
5906 }
5907 int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKCOption_u16Z_Some_get_some(uint64_t ptr) {
5908         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
5909         assert(obj->tag == LDKCOption_u16Z_Some);
5910                         int16_t some_conv = obj->some;
5911         return some_conv;
5912 }
5913 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr"))) TS_LDKCOption_ChannelShutdownStateZ_ty_from_ptr(uint64_t ptr) {
5914         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5915         switch(obj->tag) {
5916                 case LDKCOption_ChannelShutdownStateZ_Some: return 0;
5917                 case LDKCOption_ChannelShutdownStateZ_None: return 1;
5918                 default: abort();
5919         }
5920 }
5921 uint32_t __attribute__((export_name("TS_LDKCOption_ChannelShutdownStateZ_Some_get_some"))) TS_LDKCOption_ChannelShutdownStateZ_Some_get_some(uint64_t ptr) {
5922         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
5923         assert(obj->tag == LDKCOption_ChannelShutdownStateZ_Some);
5924                         uint32_t some_conv = LDKChannelShutdownState_to_js(obj->some);
5925         return some_conv;
5926 }
5927 static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5928 CHECK(owner->result_ok);
5929         return ThirtyTwoBytes_clone(&*owner->contents.result);
5930 }
5931 int8_tArray  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_ok"))) TS_CResult__u832APIErrorZ_get_ok(uint64_t owner) {
5932         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5933         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
5934         memcpy(ret_arr->elems, CResult__u832APIErrorZ_get_ok(owner_conv).data, 32);
5935         return ret_arr;
5936 }
5937
5938 static inline struct LDKAPIError CResult__u832APIErrorZ_get_err(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){
5939 CHECK(!owner->result_ok);
5940         return APIError_clone(&*owner->contents.err);
5941 }
5942 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_CResult__u832APIErrorZ_get_err(uint64_t owner) {
5943         LDKCResult__u832APIErrorZ* owner_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(owner);
5944         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5945         *ret_copy = CResult__u832APIErrorZ_get_err(owner_conv);
5946         uint64_t ret_ref = tag_ptr(ret_copy, true);
5947         return ret_ref;
5948 }
5949
5950 uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) {
5951         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5952         switch(obj->tag) {
5953                 case LDKRecentPaymentDetails_Pending: return 0;
5954                 case LDKRecentPaymentDetails_Fulfilled: return 1;
5955                 case LDKRecentPaymentDetails_Abandoned: return 2;
5956                 default: abort();
5957         }
5958 }
5959 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) {
5960         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5961         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5962                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5963                         memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32);
5964         return payment_hash_arr;
5965 }
5966 int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) {
5967         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5968         assert(obj->tag == LDKRecentPaymentDetails_Pending);
5969                         int64_t total_msat_conv = obj->pending.total_msat;
5970         return total_msat_conv;
5971 }
5972 uint64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) {
5973         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5974         assert(obj->tag == LDKRecentPaymentDetails_Fulfilled);
5975                         uint64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
5976         return payment_hash_ref;
5977 }
5978 int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) {
5979         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
5980         assert(obj->tag == LDKRecentPaymentDetails_Abandoned);
5981                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
5982                         memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32);
5983         return payment_hash_arr;
5984 }
5985 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
5986         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
5987         for (size_t i = 0; i < ret.datalen; i++) {
5988                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
5989         }
5990         return ret;
5991 }
5992 uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) {
5993         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
5994         switch(obj->tag) {
5995                 case LDKPaymentSendFailure_ParameterError: return 0;
5996                 case LDKPaymentSendFailure_PathParameterError: return 1;
5997                 case LDKPaymentSendFailure_AllFailedResendSafe: return 2;
5998                 case LDKPaymentSendFailure_DuplicatePayment: return 3;
5999                 case LDKPaymentSendFailure_PartialFailure: return 4;
6000                 default: abort();
6001         }
6002 }
6003 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_ParameterError_get_parameter_error"))) TS_LDKPaymentSendFailure_ParameterError_get_parameter_error(uint64_t ptr) {
6004         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6005         assert(obj->tag == LDKPaymentSendFailure_ParameterError);
6006                         uint64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
6007         return parameter_error_ref;
6008 }
6009 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error"))) TS_LDKPaymentSendFailure_PathParameterError_get_path_parameter_error(uint64_t ptr) {
6010         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6011         assert(obj->tag == LDKPaymentSendFailure_PathParameterError);
6012                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
6013                         uint64_tArray path_parameter_error_arr = NULL;
6014                         path_parameter_error_arr = init_uint64_tArray(path_parameter_error_var.datalen, __LINE__);
6015                         uint64_t *path_parameter_error_arr_ptr = (uint64_t*)(((uint8_t*)path_parameter_error_arr) + 8);
6016                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
6017                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6018                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
6019                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
6020                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
6021                         }
6022                         
6023         return path_parameter_error_arr;
6024 }
6025 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) {
6026         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6027         assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe);
6028                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
6029                         uint64_tArray all_failed_resend_safe_arr = NULL;
6030                         all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__);
6031                         uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8);
6032                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
6033                                 uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
6034                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
6035                         }
6036                         
6037         return all_failed_resend_safe_arr;
6038 }
6039 uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) {
6040         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6041         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6042                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
6043                         uint64_tArray results_arr = NULL;
6044                         results_arr = init_uint64_tArray(results_var.datalen, __LINE__);
6045                         uint64_t *results_arr_ptr = (uint64_t*)(((uint8_t*)results_arr) + 8);
6046                         for (size_t w = 0; w < results_var.datalen; w++) {
6047                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6048                                 *results_conv_22_conv = results_var.data[w];
6049                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
6050                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
6051                         }
6052                         
6053         return results_arr;
6054 }
6055 uint64_t __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry"))) TS_LDKPaymentSendFailure_PartialFailure_get_failed_paths_retry(uint64_t ptr) {
6056         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6057         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6058                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
6059                         uint64_t failed_paths_retry_ref = 0;
6060                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
6061                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
6062         return failed_paths_retry_ref;
6063 }
6064 int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_payment_id"))) TS_LDKPaymentSendFailure_PartialFailure_get_payment_id(uint64_t ptr) {
6065         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
6066         assert(obj->tag == LDKPaymentSendFailure_PartialFailure);
6067                         int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__);
6068                         memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32);
6069         return payment_id_arr;
6070 }
6071 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6072 CHECK(owner->result_ok);
6073         return *owner->contents.result;
6074 }
6075 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) {
6076         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6077         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
6078 }
6079
6080 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
6081 CHECK(!owner->result_ok);
6082         return PaymentSendFailure_clone(&*owner->contents.err);
6083 }
6084 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) {
6085         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
6086         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6087         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
6088         uint64_t ret_ref = tag_ptr(ret_copy, true);
6089         return ret_ref;
6090 }
6091
6092 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6093 CHECK(owner->result_ok);
6094         return *owner->contents.result;
6095 }
6096 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) {
6097         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6098         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
6099 }
6100
6101 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
6102 CHECK(!owner->result_ok);
6103         return RetryableSendFailure_clone(&*owner->contents.err);
6104 }
6105 uint32_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) {
6106         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
6107         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
6108         return ret_conv;
6109 }
6110
6111 static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
6112 CHECK(owner->result_ok);
6113         return ThirtyTwoBytes_clone(&*owner->contents.result);
6114 }
6115 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_ok(uint64_t owner) {
6116         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
6117         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6118         memcpy(ret_arr->elems, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data, 32);
6119         return ret_arr;
6120 }
6121
6122 static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){
6123 CHECK(!owner->result_ok);
6124         return PaymentSendFailure_clone(&*owner->contents.err);
6125 }
6126 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_err(uint64_t owner) {
6127         LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner);
6128         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6129         *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv);
6130         uint64_t ret_ref = tag_ptr(ret_copy, true);
6131         return ret_ref;
6132 }
6133
6134 static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
6135 CHECK(owner->result_ok);
6136         return ThirtyTwoBytes_clone(&*owner->contents.result);
6137 }
6138 int8_tArray  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_ok(uint64_t owner) {
6139         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
6140         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6141         memcpy(ret_arr->elems, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data, 32);
6142         return ret_arr;
6143 }
6144
6145 static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){
6146 CHECK(!owner->result_ok);
6147         return RetryableSendFailure_clone(&*owner->contents.err);
6148 }
6149 uint32_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_err(uint64_t owner) {
6150         LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner);
6151         uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv));
6152         return ret_conv;
6153 }
6154
6155 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6156         return ThirtyTwoBytes_clone(&owner->a);
6157 }
6158 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_a"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint64_t owner) {
6159         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6160         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6161         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_a(owner_conv).data, 32);
6162         return ret_arr;
6163 }
6164
6165 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){
6166         return ThirtyTwoBytes_clone(&owner->b);
6167 }
6168 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_get_b"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint64_t owner) {
6169         LDKC2Tuple_PaymentHashPaymentIdZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(owner);
6170         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6171         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentIdZ_get_b(owner_conv).data, 32);
6172         return ret_arr;
6173 }
6174
6175 static inline struct LDKC2Tuple_PaymentHashPaymentIdZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6176 CHECK(owner->result_ok);
6177         return C2Tuple_PaymentHashPaymentIdZ_clone(&*owner->contents.result);
6178 }
6179 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint64_t owner) {
6180         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6181         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
6182         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(owner_conv);
6183         return tag_ptr(ret_conv, true);
6184 }
6185
6186 static inline struct LDKPaymentSendFailure CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR owner){
6187 CHECK(!owner->result_ok);
6188         return PaymentSendFailure_clone(&*owner->contents.err);
6189 }
6190 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint64_t owner) {
6191         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(owner);
6192         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
6193         *ret_copy = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(owner_conv);
6194         uint64_t ret_ref = tag_ptr(ret_copy, true);
6195         return ret_ref;
6196 }
6197
6198 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
6199         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
6200         for (size_t i = 0; i < ret.datalen; i++) {
6201                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
6202         }
6203         return ret;
6204 }
6205 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_a(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6206         return ThirtyTwoBytes_clone(&owner->a);
6207 }
6208 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_a"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_a(uint64_t owner) {
6209         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6210         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6211         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_a(owner_conv).data, 32);
6212         return ret_arr;
6213 }
6214
6215 static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR owner){
6216         return ThirtyTwoBytes_clone(&owner->b);
6217 }
6218 int8_tArray  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_get_b"))) TS_C2Tuple_PaymentHashPaymentSecretZ_get_b(uint64_t owner) {
6219         LDKC2Tuple_PaymentHashPaymentSecretZ* owner_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(owner);
6220         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6221         memcpy(ret_arr->elems, C2Tuple_PaymentHashPaymentSecretZ_get_b(owner_conv).data, 32);
6222         return ret_arr;
6223 }
6224
6225 static inline struct LDKC2Tuple_PaymentHashPaymentSecretZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6226 CHECK(owner->result_ok);
6227         return C2Tuple_PaymentHashPaymentSecretZ_clone(&*owner->contents.result);
6228 }
6229 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint64_t owner) {
6230         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6231         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
6232         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(owner_conv);
6233         return tag_ptr(ret_conv, true);
6234 }
6235
6236 static inline void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR owner){
6237 CHECK(!owner->result_ok);
6238         return *owner->contents.err;
6239 }
6240 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint64_t owner) {
6241         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* owner_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(owner);
6242         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(owner_conv);
6243 }
6244
6245 static inline struct LDKThirtyTwoBytes CResult_PaymentSecretNoneZ_get_ok(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6246 CHECK(owner->result_ok);
6247         return ThirtyTwoBytes_clone(&*owner->contents.result);
6248 }
6249 int8_tArray  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_ok"))) TS_CResult_PaymentSecretNoneZ_get_ok(uint64_t owner) {
6250         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6251         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6252         memcpy(ret_arr->elems, CResult_PaymentSecretNoneZ_get_ok(owner_conv).data, 32);
6253         return ret_arr;
6254 }
6255
6256 static inline void CResult_PaymentSecretNoneZ_get_err(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR owner){
6257 CHECK(!owner->result_ok);
6258         return *owner->contents.err;
6259 }
6260 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_get_err"))) TS_CResult_PaymentSecretNoneZ_get_err(uint64_t owner) {
6261         LDKCResult_PaymentSecretNoneZ* owner_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(owner);
6262         CResult_PaymentSecretNoneZ_get_err(owner_conv);
6263 }
6264
6265 static inline struct LDKThirtyTwoBytes CResult_PaymentPreimageAPIErrorZ_get_ok(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6266 CHECK(owner->result_ok);
6267         return ThirtyTwoBytes_clone(&*owner->contents.result);
6268 }
6269 int8_tArray  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_get_ok(uint64_t owner) {
6270         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
6271         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6272         memcpy(ret_arr->elems, CResult_PaymentPreimageAPIErrorZ_get_ok(owner_conv).data, 32);
6273         return ret_arr;
6274 }
6275
6276 static inline struct LDKAPIError CResult_PaymentPreimageAPIErrorZ_get_err(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR owner){
6277 CHECK(!owner->result_ok);
6278         return APIError_clone(&*owner->contents.err);
6279 }
6280 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_get_err"))) TS_CResult_PaymentPreimageAPIErrorZ_get_err(uint64_t owner) {
6281         LDKCResult_PaymentPreimageAPIErrorZ* owner_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(owner);
6282         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
6283         *ret_copy = CResult_PaymentPreimageAPIErrorZ_get_err(owner_conv);
6284         uint64_t ret_ref = tag_ptr(ret_copy, true);
6285         return ret_ref;
6286 }
6287
6288 uint32_t __attribute__((export_name("TS_LDKCOption_CVec_ChainHashZZ_ty_from_ptr"))) TS_LDKCOption_CVec_ChainHashZZ_ty_from_ptr(uint64_t ptr) {
6289         LDKCOption_CVec_ChainHashZZ *obj = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(ptr);
6290         switch(obj->tag) {
6291                 case LDKCOption_CVec_ChainHashZZ_Some: return 0;
6292                 case LDKCOption_CVec_ChainHashZZ_None: return 1;
6293                 default: abort();
6294         }
6295 }
6296 ptrArray __attribute__((export_name("TS_LDKCOption_CVec_ChainHashZZ_Some_get_some"))) TS_LDKCOption_CVec_ChainHashZZ_Some_get_some(uint64_t ptr) {
6297         LDKCOption_CVec_ChainHashZZ *obj = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(ptr);
6298         assert(obj->tag == LDKCOption_CVec_ChainHashZZ_Some);
6299                         LDKCVec_ChainHashZ some_var = obj->some;
6300                         ptrArray some_arr = NULL;
6301                         some_arr = init_ptrArray(some_var.datalen, __LINE__);
6302                         int8_tArray *some_arr_ptr = (int8_tArray*)(((uint8_t*)some_arr) + 8);
6303                         for (size_t m = 0; m < some_var.datalen; m++) {
6304                                 int8_tArray some_conv_12_arr = init_int8_tArray(32, __LINE__);
6305                                 memcpy(some_conv_12_arr->elems, some_var.data[m].data, 32);
6306                                 some_arr_ptr[m] = some_conv_12_arr;
6307                         }
6308                         
6309         return some_arr;
6310 }
6311 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6312         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
6313         ret.is_owned = false;
6314         return ret;
6315 }
6316 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(uint64_t owner) {
6317         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6318         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
6319         uint64_t ret_ref = 0;
6320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6322         return ret_ref;
6323 }
6324
6325 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
6326 CHECK(!owner->result_ok);
6327         return DecodeError_clone(&*owner->contents.err);
6328 }
6329 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(uint64_t owner) {
6330         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
6331         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6332         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
6333         uint64_t ret_ref = tag_ptr(ret_copy, true);
6334         return ret_ref;
6335 }
6336
6337 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6338         LDKChannelCounterparty ret = *owner->contents.result;
6339         ret.is_owned = false;
6340         return ret;
6341 }
6342 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_ok(uint64_t owner) {
6343         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6344         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
6345         uint64_t ret_ref = 0;
6346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6348         return ret_ref;
6349 }
6350
6351 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
6352 CHECK(!owner->result_ok);
6353         return DecodeError_clone(&*owner->contents.err);
6354 }
6355 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_get_err(uint64_t owner) {
6356         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
6357         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6358         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
6359         uint64_t ret_ref = tag_ptr(ret_copy, true);
6360         return ret_ref;
6361 }
6362
6363 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6364         LDKChannelDetails ret = *owner->contents.result;
6365         ret.is_owned = false;
6366         return ret;
6367 }
6368 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_ok(uint64_t owner) {
6369         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6370         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
6371         uint64_t ret_ref = 0;
6372         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6373         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6374         return ret_ref;
6375 }
6376
6377 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
6378 CHECK(!owner->result_ok);
6379         return DecodeError_clone(&*owner->contents.err);
6380 }
6381 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_get_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_get_err(uint64_t owner) {
6382         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
6383         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6384         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
6385         uint64_t ret_ref = tag_ptr(ret_copy, true);
6386         return ret_ref;
6387 }
6388
6389 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6390         LDKPhantomRouteHints ret = *owner->contents.result;
6391         ret.is_owned = false;
6392         return ret;
6393 }
6394 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_ok(uint64_t owner) {
6395         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6396         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
6397         uint64_t ret_ref = 0;
6398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6400         return ret_ref;
6401 }
6402
6403 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
6404 CHECK(!owner->result_ok);
6405         return DecodeError_clone(&*owner->contents.err);
6406 }
6407 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_get_err(uint64_t owner) {
6408         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
6409         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6410         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
6411         uint64_t ret_ref = tag_ptr(ret_copy, true);
6412         return ret_ref;
6413 }
6414
6415 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6416 CHECK(owner->result_ok);
6417         return ChannelShutdownState_clone(&*owner->contents.result);
6418 }
6419 uint32_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_ok(uint64_t owner) {
6420         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6421         uint32_t ret_conv = LDKChannelShutdownState_to_js(CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
6422         return ret_conv;
6423 }
6424
6425 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
6426 CHECK(!owner->result_ok);
6427         return DecodeError_clone(&*owner->contents.err);
6428 }
6429 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_get_err(uint64_t owner) {
6430         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
6431         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6432         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
6433         uint64_t ret_ref = tag_ptr(ret_copy, true);
6434         return ret_ref;
6435 }
6436
6437 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
6438         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
6439         for (size_t i = 0; i < ret.datalen; i++) {
6440                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
6441         }
6442         return ret;
6443 }
6444 typedef struct LDKWatch_JCalls {
6445         atomic_size_t refcnt;
6446         uint32_t instance_ptr;
6447 } LDKWatch_JCalls;
6448 static void LDKWatch_JCalls_free(void* this_arg) {
6449         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6450         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6451                 FREE(j_calls);
6452         }
6453 }
6454 LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
6455         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6456         LDKOutPoint funding_txo_var = funding_txo;
6457         uint64_t funding_txo_ref = 0;
6458         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6459         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6460         LDKChannelMonitor monitor_var = monitor;
6461         uint64_t monitor_ref = 0;
6462         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
6463         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
6464         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, monitor_ref, 0, 0, 0, 0);
6465         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
6466         return ret_conv;
6467 }
6468 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
6469         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6470         LDKOutPoint funding_txo_var = funding_txo;
6471         uint64_t funding_txo_ref = 0;
6472         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
6473         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
6474         LDKChannelMonitorUpdate update_var = *update;
6475         uint64_t update_ref = 0;
6476         update_var = ChannelMonitorUpdate_clone(&update_var);
6477         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
6478         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
6479         uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 19, funding_txo_ref, update_ref, 0, 0, 0, 0);
6480         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
6481         return ret_conv;
6482 }
6483 LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
6484         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
6485         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 20, 0, 0, 0, 0, 0, 0);
6486         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_constr;
6487         ret_constr.datalen = ret->arr_len;
6488         if (ret_constr.datalen > 0)
6489                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
6490         else
6491                 ret_constr.data = NULL;
6492         uint64_t* ret_vals = ret->elems;
6493         for (size_t x = 0; x < ret_constr.datalen; x++) {
6494                 uint64_t ret_conv_49 = ret_vals[x];
6495                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
6496                 CHECK_ACCESS(ret_conv_49_ptr);
6497                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ ret_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(ret_conv_49_ptr);
6498                 FREE(untag_ptr(ret_conv_49));
6499                 ret_constr.data[x] = ret_conv_49_conv;
6500         }
6501         FREE(ret);
6502         return ret_constr;
6503 }
6504 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
6505         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
6506         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6507 }
6508 static inline LDKWatch LDKWatch_init (JSValue o) {
6509         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
6510         atomic_init(&calls->refcnt, 1);
6511         calls->instance_ptr = o;
6512
6513         LDKWatch ret = {
6514                 .this_arg = (void*) calls,
6515                 .watch_channel = watch_channel_LDKWatch_jcall,
6516                 .update_channel = update_channel_LDKWatch_jcall,
6517                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
6518                 .free = LDKWatch_JCalls_free,
6519         };
6520         return ret;
6521 }
6522 uint64_t  __attribute__((export_name("TS_LDKWatch_new"))) TS_LDKWatch_new(JSValue o) {
6523         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
6524         *res_ptr = LDKWatch_init(o);
6525         return tag_ptr(res_ptr, true);
6526 }
6527 uint32_t  __attribute__((export_name("TS_Watch_watch_channel"))) TS_Watch_watch_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t monitor) {
6528         void* this_arg_ptr = untag_ptr(this_arg);
6529         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6530         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6531         LDKOutPoint funding_txo_conv;
6532         funding_txo_conv.inner = untag_ptr(funding_txo);
6533         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6534         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6535         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6536         LDKChannelMonitor monitor_conv;
6537         monitor_conv.inner = untag_ptr(monitor);
6538         monitor_conv.is_owned = ptr_is_owned(monitor);
6539         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
6540         monitor_conv = ChannelMonitor_clone(&monitor_conv);
6541         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv));
6542         return ret_conv;
6543 }
6544
6545 uint32_t  __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_update_channel(uint64_t this_arg, uint64_t funding_txo, uint64_t update) {
6546         void* this_arg_ptr = untag_ptr(this_arg);
6547         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6548         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6549         LDKOutPoint funding_txo_conv;
6550         funding_txo_conv.inner = untag_ptr(funding_txo);
6551         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
6552         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
6553         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6554         LDKChannelMonitorUpdate update_conv;
6555         update_conv.inner = untag_ptr(update);
6556         update_conv.is_owned = ptr_is_owned(update);
6557         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
6558         update_conv.is_owned = false;
6559         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
6560         return ret_conv;
6561 }
6562
6563 uint64_tArray  __attribute__((export_name("TS_Watch_release_pending_monitor_events"))) TS_Watch_release_pending_monitor_events(uint64_t this_arg) {
6564         void* this_arg_ptr = untag_ptr(this_arg);
6565         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6566         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
6567         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
6568         uint64_tArray ret_arr = NULL;
6569         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
6570         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
6571         for (size_t x = 0; x < ret_var.datalen; x++) {
6572                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
6573                 *ret_conv_49_conv = ret_var.data[x];
6574                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
6575         }
6576         
6577         FREE(ret_var.data);
6578         return ret_arr;
6579 }
6580
6581 typedef struct LDKBroadcasterInterface_JCalls {
6582         atomic_size_t refcnt;
6583         uint32_t instance_ptr;
6584 } LDKBroadcasterInterface_JCalls;
6585 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
6586         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6587         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6588                 FREE(j_calls);
6589         }
6590 }
6591 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
6592         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
6593         LDKCVec_TransactionZ txs_var = txs;
6594         ptrArray txs_arr = NULL;
6595         txs_arr = init_ptrArray(txs_var.datalen, __LINE__);
6596         int8_tArray *txs_arr_ptr = (int8_tArray*)(((uint8_t*)txs_arr) + 8);
6597         for (size_t m = 0; m < txs_var.datalen; m++) {
6598                 LDKTransaction txs_conv_12_var = txs_var.data[m];
6599                 int8_tArray txs_conv_12_arr = init_int8_tArray(txs_conv_12_var.datalen, __LINE__);
6600                 memcpy(txs_conv_12_arr->elems, txs_conv_12_var.data, txs_conv_12_var.datalen);
6601                 Transaction_free(txs_conv_12_var);
6602                 txs_arr_ptr[m] = txs_conv_12_arr;
6603         }
6604         
6605         FREE(txs_var.data);
6606         js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, (uint32_t)txs_arr, 0, 0, 0, 0, 0);
6607 }
6608 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
6609         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
6610         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6611 }
6612 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JSValue o) {
6613         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
6614         atomic_init(&calls->refcnt, 1);
6615         calls->instance_ptr = o;
6616
6617         LDKBroadcasterInterface ret = {
6618                 .this_arg = (void*) calls,
6619                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
6620                 .free = LDKBroadcasterInterface_JCalls_free,
6621         };
6622         return ret;
6623 }
6624 uint64_t  __attribute__((export_name("TS_LDKBroadcasterInterface_new"))) TS_LDKBroadcasterInterface_new(JSValue o) {
6625         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
6626         *res_ptr = LDKBroadcasterInterface_init(o);
6627         return tag_ptr(res_ptr, true);
6628 }
6629 void  __attribute__((export_name("TS_BroadcasterInterface_broadcast_transactions"))) TS_BroadcasterInterface_broadcast_transactions(uint64_t this_arg, ptrArray txs) {
6630         void* this_arg_ptr = untag_ptr(this_arg);
6631         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6632         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
6633         LDKCVec_TransactionZ txs_constr;
6634         txs_constr.datalen = txs->arr_len;
6635         if (txs_constr.datalen > 0)
6636                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
6637         else
6638                 txs_constr.data = NULL;
6639         int8_tArray* txs_vals = (void*) txs->elems;
6640         for (size_t m = 0; m < txs_constr.datalen; m++) {
6641                 int8_tArray txs_conv_12 = txs_vals[m];
6642                 LDKTransaction txs_conv_12_ref;
6643                 txs_conv_12_ref.datalen = txs_conv_12->arr_len;
6644                 txs_conv_12_ref.data = MALLOC(txs_conv_12_ref.datalen, "LDKTransaction Bytes");
6645                 memcpy(txs_conv_12_ref.data, txs_conv_12->elems, txs_conv_12_ref.datalen); FREE(txs_conv_12);
6646                 txs_conv_12_ref.data_is_owned = true;
6647                 txs_constr.data[m] = txs_conv_12_ref;
6648         }
6649         FREE(txs);
6650         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
6651 }
6652
6653 typedef struct LDKEntropySource_JCalls {
6654         atomic_size_t refcnt;
6655         uint32_t instance_ptr;
6656 } LDKEntropySource_JCalls;
6657 static void LDKEntropySource_JCalls_free(void* this_arg) {
6658         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6659         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6660                 FREE(j_calls);
6661         }
6662 }
6663 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
6664         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
6665         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0);
6666         LDKThirtyTwoBytes ret_ref;
6667         CHECK(ret->arr_len == 32);
6668         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6669         return ret_ref;
6670 }
6671 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
6672         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
6673         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6674 }
6675 static inline LDKEntropySource LDKEntropySource_init (JSValue o) {
6676         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
6677         atomic_init(&calls->refcnt, 1);
6678         calls->instance_ptr = o;
6679
6680         LDKEntropySource ret = {
6681                 .this_arg = (void*) calls,
6682                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
6683                 .free = LDKEntropySource_JCalls_free,
6684         };
6685         return ret;
6686 }
6687 uint64_t  __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) {
6688         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
6689         *res_ptr = LDKEntropySource_init(o);
6690         return tag_ptr(res_ptr, true);
6691 }
6692 int8_tArray  __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) {
6693         void* this_arg_ptr = untag_ptr(this_arg);
6694         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6695         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
6696         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6697         memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32);
6698         return ret_arr;
6699 }
6700
6701 uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) {
6702         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6703         switch(obj->tag) {
6704                 case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0;
6705                 case LDKUnsignedGossipMessage_ChannelUpdate: return 1;
6706                 case LDKUnsignedGossipMessage_NodeAnnouncement: return 2;
6707                 default: abort();
6708         }
6709 }
6710 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) {
6711         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6712         assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement);
6713                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
6714                         uint64_t channel_announcement_ref = 0;
6715                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
6716                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
6717         return channel_announcement_ref;
6718 }
6719 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) {
6720         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6721         assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate);
6722                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
6723                         uint64_t channel_update_ref = 0;
6724                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
6725                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
6726         return channel_update_ref;
6727 }
6728 uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) {
6729         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
6730         assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement);
6731                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
6732                         uint64_t node_announcement_ref = 0;
6733                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
6734                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
6735         return node_announcement_ref;
6736 }
6737 typedef struct LDKNodeSigner_JCalls {
6738         atomic_size_t refcnt;
6739         uint32_t instance_ptr;
6740 } LDKNodeSigner_JCalls;
6741 static void LDKNodeSigner_JCalls_free(void* this_arg) {
6742         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6743         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6744                 FREE(j_calls);
6745         }
6746 }
6747 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
6748         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6749         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, 0, 0, 0, 0, 0, 0);
6750         LDKThirtyTwoBytes ret_ref;
6751         CHECK(ret->arr_len == 32);
6752         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6753         return ret_ref;
6754 }
6755 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
6756         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6757         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6758         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 24, recipient_conv, 0, 0, 0, 0, 0);
6759         void* ret_ptr = untag_ptr(ret);
6760         CHECK_ACCESS(ret_ptr);
6761         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
6762         FREE(untag_ptr(ret));
6763         return ret_conv;
6764 }
6765 LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) {
6766         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6767         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6768         int8_tArray other_key_arr = init_int8_tArray(33, __LINE__);
6769         memcpy(other_key_arr->elems, other_key.compressed_form, 33);
6770         LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
6771         *tweak_copy = tweak;
6772         uint64_t tweak_ref = tag_ptr(tweak_copy, true);
6773         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 25, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0);
6774         void* ret_ptr = untag_ptr(ret);
6775         CHECK_ACCESS(ret_ptr);
6776         LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr);
6777         FREE(untag_ptr(ret));
6778         return ret_conv;
6779 }
6780 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
6781         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6782         LDKu8slice hrp_bytes_var = hrp_bytes;
6783         int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__);
6784         memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen);
6785         LDKCVec_U5Z invoice_data_var = invoice_data;
6786         ptrArray invoice_data_arr = NULL;
6787         invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__);
6788         int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8);
6789         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
6790                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
6791                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
6792         }
6793         
6794         FREE(invoice_data_var.data);
6795         uint32_t recipient_conv = LDKRecipient_to_js(recipient);
6796         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);
6797         void* ret_ptr = untag_ptr(ret);
6798         CHECK_ACCESS(ret_ptr);
6799         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
6800         FREE(untag_ptr(ret));
6801         return ret_conv;
6802 }
6803 LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
6804         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
6805         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
6806         *msg_copy = msg;
6807         uint64_t msg_ref = tag_ptr(msg_copy, true);
6808         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, msg_ref, 0, 0, 0, 0, 0);
6809         void* ret_ptr = untag_ptr(ret);
6810         CHECK_ACCESS(ret_ptr);
6811         LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr);
6812         FREE(untag_ptr(ret));
6813         return ret_conv;
6814 }
6815 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
6816         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
6817         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6818 }
6819 static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) {
6820         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
6821         atomic_init(&calls->refcnt, 1);
6822         calls->instance_ptr = o;
6823
6824         LDKNodeSigner ret = {
6825                 .this_arg = (void*) calls,
6826                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
6827                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
6828                 .ecdh = ecdh_LDKNodeSigner_jcall,
6829                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
6830                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
6831                 .free = LDKNodeSigner_JCalls_free,
6832         };
6833         return ret;
6834 }
6835 uint64_t  __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) {
6836         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
6837         *res_ptr = LDKNodeSigner_init(o);
6838         return tag_ptr(res_ptr, true);
6839 }
6840 int8_tArray  __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) {
6841         void* this_arg_ptr = untag_ptr(this_arg);
6842         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6843         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6844         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
6845         memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32);
6846         return ret_arr;
6847 }
6848
6849 uint64_t  __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) {
6850         void* this_arg_ptr = untag_ptr(this_arg);
6851         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6852         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6853         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6854         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
6855         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
6856         return tag_ptr(ret_conv, true);
6857 }
6858
6859 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) {
6860         void* this_arg_ptr = untag_ptr(this_arg);
6861         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6862         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6863         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6864         LDKPublicKey other_key_ref;
6865         CHECK(other_key->arr_len == 33);
6866         memcpy(other_key_ref.compressed_form, other_key->elems, 33); FREE(other_key);
6867         void* tweak_ptr = untag_ptr(tweak);
6868         CHECK_ACCESS(tweak_ptr);
6869         LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr);
6870         tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak));
6871         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
6872         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
6873         return tag_ptr(ret_conv, true);
6874 }
6875
6876 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) {
6877         void* this_arg_ptr = untag_ptr(this_arg);
6878         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6879         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6880         LDKu8slice hrp_bytes_ref;
6881         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
6882         hrp_bytes_ref.data = hrp_bytes->elems;
6883         LDKCVec_U5Z invoice_data_constr;
6884         invoice_data_constr.datalen = invoice_data->arr_len;
6885         if (invoice_data_constr.datalen > 0)
6886                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
6887         else
6888                 invoice_data_constr.data = NULL;
6889         int8_t* invoice_data_vals = (void*) invoice_data->elems;
6890         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
6891                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
6892                 
6893                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
6894         }
6895         FREE(invoice_data);
6896         LDKRecipient recipient_conv = LDKRecipient_from_js(recipient);
6897         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
6898         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
6899         FREE(hrp_bytes);
6900         return tag_ptr(ret_conv, true);
6901 }
6902
6903 uint64_t  __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) {
6904         void* this_arg_ptr = untag_ptr(this_arg);
6905         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6906         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
6907         void* msg_ptr = untag_ptr(msg);
6908         CHECK_ACCESS(msg_ptr);
6909         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
6910         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
6911         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6912         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
6913         return tag_ptr(ret_conv, true);
6914 }
6915
6916 typedef struct LDKSignerProvider_JCalls {
6917         atomic_size_t refcnt;
6918         uint32_t instance_ptr;
6919 } LDKSignerProvider_JCalls;
6920 static void LDKSignerProvider_JCalls_free(void* this_arg) {
6921         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6922         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6923                 FREE(j_calls);
6924         }
6925 }
6926 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
6927         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6928         jboolean inbound_conv = inbound;
6929         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6930         int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__);
6931         memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16);
6932         int8_tArray ret = (int8_tArray)js_invoke_function_ubuuuu(j_calls->instance_ptr, 28, inbound_conv, channel_value_satoshis_conv, (uint32_t)user_channel_id_arr, 0, 0, 0);
6933         LDKThirtyTwoBytes ret_ref;
6934         CHECK(ret->arr_len == 32);
6935         memcpy(ret_ref.data, ret->elems, 32); FREE(ret);
6936         return ret_ref;
6937 }
6938 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
6939         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6940         int64_t channel_value_satoshis_conv = channel_value_satoshis;
6941         int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__);
6942         memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32);
6943         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 29, channel_value_satoshis_conv, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0);
6944         void* ret_ptr = untag_ptr(ret);
6945         CHECK_ACCESS(ret_ptr);
6946         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
6947         FREE(untag_ptr(ret));
6948         return ret_conv;
6949 }
6950 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
6951         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6952         LDKu8slice reader_var = reader;
6953         int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__);
6954         memcpy(reader_arr->elems, reader_var.data, reader_var.datalen);
6955         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, (uint32_t)reader_arr, 0, 0, 0, 0, 0);
6956         void* ret_ptr = untag_ptr(ret);
6957         CHECK_ACCESS(ret_ptr);
6958         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
6959         FREE(untag_ptr(ret));
6960         return ret_conv;
6961 }
6962 LDKCResult_ScriptNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg) {
6963         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6964         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0);
6965         void* ret_ptr = untag_ptr(ret);
6966         CHECK_ACCESS(ret_ptr);
6967         LDKCResult_ScriptNoneZ ret_conv = *(LDKCResult_ScriptNoneZ*)(ret_ptr);
6968         FREE(untag_ptr(ret));
6969         return ret_conv;
6970 }
6971 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
6972         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
6973         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, 0, 0, 0, 0, 0, 0);
6974         void* ret_ptr = untag_ptr(ret);
6975         CHECK_ACCESS(ret_ptr);
6976         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
6977         FREE(untag_ptr(ret));
6978         return ret_conv;
6979 }
6980 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
6981         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
6982         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6983 }
6984 static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) {
6985         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
6986         atomic_init(&calls->refcnt, 1);
6987         calls->instance_ptr = o;
6988
6989         LDKSignerProvider ret = {
6990                 .this_arg = (void*) calls,
6991                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
6992                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
6993                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
6994                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
6995                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
6996                 .free = LDKSignerProvider_JCalls_free,
6997         };
6998         return ret;
6999 }
7000 uint64_t  __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) {
7001         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
7002         *res_ptr = LDKSignerProvider_init(o);
7003         return tag_ptr(res_ptr, true);
7004 }
7005 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) {
7006         void* this_arg_ptr = untag_ptr(this_arg);
7007         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7008         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7009         LDKU128 user_channel_id_ref;
7010         CHECK(user_channel_id->arr_len == 16);
7011         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
7012         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7013         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);
7014         return ret_arr;
7015 }
7016
7017 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) {
7018         void* this_arg_ptr = untag_ptr(this_arg);
7019         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7020         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7021         LDKThirtyTwoBytes channel_keys_id_ref;
7022         CHECK(channel_keys_id->arr_len == 32);
7023         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
7024         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
7025         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
7026         return tag_ptr(ret_ret, true);
7027 }
7028
7029 uint64_t  __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) {
7030         void* this_arg_ptr = untag_ptr(this_arg);
7031         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7032         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7033         LDKu8slice reader_ref;
7034         reader_ref.datalen = reader->arr_len;
7035         reader_ref.data = reader->elems;
7036         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
7037         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
7038         FREE(reader);
7039         return tag_ptr(ret_conv, true);
7040 }
7041
7042 uint64_t  __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) {
7043         void* this_arg_ptr = untag_ptr(this_arg);
7044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7045         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7046         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
7047         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
7048         return tag_ptr(ret_conv, true);
7049 }
7050
7051 uint64_t  __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) {
7052         void* this_arg_ptr = untag_ptr(this_arg);
7053         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7054         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
7055         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
7056         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
7057         return tag_ptr(ret_conv, true);
7058 }
7059
7060 typedef struct LDKFeeEstimator_JCalls {
7061         atomic_size_t refcnt;
7062         uint32_t instance_ptr;
7063 } LDKFeeEstimator_JCalls;
7064 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
7065         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7066         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7067                 FREE(j_calls);
7068         }
7069 }
7070 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
7071         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
7072         uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target);
7073         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, confirmation_target_conv, 0, 0, 0, 0, 0);
7074 }
7075 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
7076         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
7077         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7078 }
7079 static inline LDKFeeEstimator LDKFeeEstimator_init (JSValue o) {
7080         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
7081         atomic_init(&calls->refcnt, 1);
7082         calls->instance_ptr = o;
7083
7084         LDKFeeEstimator ret = {
7085                 .this_arg = (void*) calls,
7086                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
7087                 .free = LDKFeeEstimator_JCalls_free,
7088         };
7089         return ret;
7090 }
7091 uint64_t  __attribute__((export_name("TS_LDKFeeEstimator_new"))) TS_LDKFeeEstimator_new(JSValue o) {
7092         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
7093         *res_ptr = LDKFeeEstimator_init(o);
7094         return tag_ptr(res_ptr, true);
7095 }
7096 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) {
7097         void* this_arg_ptr = untag_ptr(this_arg);
7098         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7099         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
7100         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_js(confirmation_target);
7101         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
7102         return ret_conv;
7103 }
7104
7105 typedef struct LDKRouter_JCalls {
7106         atomic_size_t refcnt;
7107         uint32_t instance_ptr;
7108 } LDKRouter_JCalls;
7109 static void LDKRouter_JCalls_free(void* this_arg) {
7110         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7111         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7112                 FREE(j_calls);
7113         }
7114 }
7115 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
7116         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7117         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7118         memcpy(payer_arr->elems, payer.compressed_form, 33);
7119         LDKRouteParameters route_params_var = *route_params;
7120         uint64_t route_params_ref = 0;
7121         route_params_var = RouteParameters_clone(&route_params_var);
7122         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7123         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7124         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7125         uint64_tArray first_hops_arr = NULL;
7126         if (first_hops != NULL) {
7127                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7128                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7129                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7130                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7131                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7132                         uint64_t first_hops_conv_16_ref = 0;
7133                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7134                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7135                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7136                 }
7137         
7138         }
7139         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7140         uint64_t inflight_htlcs_ref = 0;
7141         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7142         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7143         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 34, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0, 0);
7144         void* ret_ptr = untag_ptr(ret);
7145         CHECK_ACCESS(ret_ptr);
7146         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7147         FREE(untag_ptr(ret));
7148         return ret_conv;
7149 }
7150 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) {
7151         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
7152         int8_tArray payer_arr = init_int8_tArray(33, __LINE__);
7153         memcpy(payer_arr->elems, payer.compressed_form, 33);
7154         LDKRouteParameters route_params_var = *route_params;
7155         uint64_t route_params_ref = 0;
7156         route_params_var = RouteParameters_clone(&route_params_var);
7157         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
7158         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
7159         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
7160         uint64_tArray first_hops_arr = NULL;
7161         if (first_hops != NULL) {
7162                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
7163                 first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__);
7164                 uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8);
7165                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
7166                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
7167                         uint64_t first_hops_conv_16_ref = 0;
7168                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
7169                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
7170                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
7171                 }
7172         
7173         }
7174         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
7175         uint64_t inflight_htlcs_ref = 0;
7176         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
7177         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
7178         int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__);
7179         memcpy(_payment_hash_arr->elems, _payment_hash.data, 32);
7180         int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__);
7181         memcpy(_payment_id_arr->elems, _payment_id.data, 32);
7182         uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 35, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, (uint32_t)_payment_hash_arr, (uint32_t)_payment_id_arr);
7183         void* ret_ptr = untag_ptr(ret);
7184         CHECK_ACCESS(ret_ptr);
7185         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
7186         FREE(untag_ptr(ret));
7187         return ret_conv;
7188 }
7189 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
7190         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
7191         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7192 }
7193 static inline LDKRouter LDKRouter_init (JSValue o) {
7194         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
7195         atomic_init(&calls->refcnt, 1);
7196         calls->instance_ptr = o;
7197
7198         LDKRouter ret = {
7199                 .this_arg = (void*) calls,
7200                 .find_route = find_route_LDKRouter_jcall,
7201                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
7202                 .free = LDKRouter_JCalls_free,
7203         };
7204         return ret;
7205 }
7206 uint64_t  __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) {
7207         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
7208         *res_ptr = LDKRouter_init(o);
7209         return tag_ptr(res_ptr, true);
7210 }
7211 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) {
7212         void* this_arg_ptr = untag_ptr(this_arg);
7213         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7214         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7215         LDKPublicKey payer_ref;
7216         CHECK(payer->arr_len == 33);
7217         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7218         LDKRouteParameters route_params_conv;
7219         route_params_conv.inner = untag_ptr(route_params);
7220         route_params_conv.is_owned = ptr_is_owned(route_params);
7221         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7222         route_params_conv.is_owned = false;
7223         LDKCVec_ChannelDetailsZ first_hops_constr;
7224         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7225         if (first_hops != 0) {
7226                 first_hops_constr.datalen = first_hops->arr_len;
7227                 if (first_hops_constr.datalen > 0)
7228                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7229                 else
7230                         first_hops_constr.data = NULL;
7231                 uint64_t* first_hops_vals = first_hops->elems;
7232                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7233                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7234                         LDKChannelDetails first_hops_conv_16_conv;
7235                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7236                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7237                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7238                         first_hops_conv_16_conv.is_owned = false;
7239                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7240                 }
7241                 FREE(first_hops);
7242                 first_hops_ptr = &first_hops_constr;
7243         }
7244         LDKInFlightHtlcs inflight_htlcs_conv;
7245         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7246         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7247         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7248         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7249         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7250         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
7251         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7252         return tag_ptr(ret_conv, true);
7253 }
7254
7255 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) {
7256         void* this_arg_ptr = untag_ptr(this_arg);
7257         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7258         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
7259         LDKPublicKey payer_ref;
7260         CHECK(payer->arr_len == 33);
7261         memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer);
7262         LDKRouteParameters route_params_conv;
7263         route_params_conv.inner = untag_ptr(route_params);
7264         route_params_conv.is_owned = ptr_is_owned(route_params);
7265         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
7266         route_params_conv.is_owned = false;
7267         LDKCVec_ChannelDetailsZ first_hops_constr;
7268         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
7269         if (first_hops != 0) {
7270                 first_hops_constr.datalen = first_hops->arr_len;
7271                 if (first_hops_constr.datalen > 0)
7272                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
7273                 else
7274                         first_hops_constr.data = NULL;
7275                 uint64_t* first_hops_vals = first_hops->elems;
7276                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
7277                         uint64_t first_hops_conv_16 = first_hops_vals[q];
7278                         LDKChannelDetails first_hops_conv_16_conv;
7279                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
7280                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
7281                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
7282                         first_hops_conv_16_conv.is_owned = false;
7283                         first_hops_constr.data[q] = first_hops_conv_16_conv;
7284                 }
7285                 FREE(first_hops);
7286                 first_hops_ptr = &first_hops_constr;
7287         }
7288         LDKInFlightHtlcs inflight_htlcs_conv;
7289         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
7290         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
7291         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
7292         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
7293         LDKThirtyTwoBytes _payment_hash_ref;
7294         CHECK(_payment_hash->arr_len == 32);
7295         memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash);
7296         LDKThirtyTwoBytes _payment_id_ref;
7297         CHECK(_payment_id->arr_len == 32);
7298         memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id);
7299         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7300         *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);
7301         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
7302         return tag_ptr(ret_conv, true);
7303 }
7304
7305 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7306         return ThirtyTwoBytes_clone(&owner->a);
7307 }
7308 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_a"))) TS_C2Tuple_BlockHashChannelManagerZ_get_a(uint64_t owner) {
7309         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
7310         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7311         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelManagerZ_get_a(owner_conv).data, 32);
7312         return ret_arr;
7313 }
7314
7315 static inline struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){
7316         LDKChannelManager ret = owner->b;
7317         ret.is_owned = false;
7318         return ret;
7319 }
7320 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_get_b"))) TS_C2Tuple_BlockHashChannelManagerZ_get_b(uint64_t owner) {
7321         LDKC2Tuple_BlockHashChannelManagerZ* owner_conv = (LDKC2Tuple_BlockHashChannelManagerZ*)untag_ptr(owner);
7322         LDKChannelManager ret_var = C2Tuple_BlockHashChannelManagerZ_get_b(owner_conv);
7323         uint64_t ret_ref = 0;
7324         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7325         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7326         return ret_ref;
7327 }
7328
7329 static inline struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7330 CHECK(owner->result_ok);
7331         return &*owner->contents.result;
7332 }
7333 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(uint64_t owner) {
7334         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7335         uint64_t ret_ret = tag_ptr(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
7336         return ret_ret;
7337 }
7338
7339 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
7340 CHECK(!owner->result_ok);
7341         return DecodeError_clone(&*owner->contents.err);
7342 }
7343 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(uint64_t owner) {
7344         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(owner);
7345         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7346         *ret_copy = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_err(owner_conv);
7347         uint64_t ret_ref = tag_ptr(ret_copy, true);
7348         return ret_ref;
7349 }
7350
7351 uint32_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_ty_from_ptr"))) TS_LDKMaxDustHTLCExposure_ty_from_ptr(uint64_t ptr) {
7352         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7353         switch(obj->tag) {
7354                 case LDKMaxDustHTLCExposure_FixedLimitMsat: return 0;
7355                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: return 1;
7356                 default: abort();
7357         }
7358 }
7359 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat"))) TS_LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(uint64_t ptr) {
7360         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7361         assert(obj->tag == LDKMaxDustHTLCExposure_FixedLimitMsat);
7362                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
7363         return fixed_limit_msat_conv;
7364 }
7365 int64_t __attribute__((export_name("TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier"))) TS_LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(uint64_t ptr) {
7366         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
7367         assert(obj->tag == LDKMaxDustHTLCExposure_FeeRateMultiplier);
7368                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
7369         return fee_rate_multiplier_conv;
7370 }
7371 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7372 CHECK(owner->result_ok);
7373         return MaxDustHTLCExposure_clone(&*owner->contents.result);
7374 }
7375 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(uint64_t owner) {
7376         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7377         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
7378         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
7379         uint64_t ret_ref = tag_ptr(ret_copy, true);
7380         return ret_ref;
7381 }
7382
7383 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
7384 CHECK(!owner->result_ok);
7385         return DecodeError_clone(&*owner->contents.err);
7386 }
7387 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(uint64_t owner) {
7388         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
7389         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7390         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
7391         uint64_t ret_ref = tag_ptr(ret_copy, true);
7392         return ret_ref;
7393 }
7394
7395 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7396         LDKChannelConfig ret = *owner->contents.result;
7397         ret.is_owned = false;
7398         return ret;
7399 }
7400 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_get_ok(uint64_t owner) {
7401         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7402         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
7403         uint64_t ret_ref = 0;
7404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7406         return ret_ref;
7407 }
7408
7409 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
7410 CHECK(!owner->result_ok);
7411         return DecodeError_clone(&*owner->contents.err);
7412 }
7413 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_err"))) TS_CResult_ChannelConfigDecodeErrorZ_get_err(uint64_t owner) {
7414         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
7415         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7416         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
7417         uint64_t ret_ref = tag_ptr(ret_copy, true);
7418         return ret_ref;
7419 }
7420
7421 uint32_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr"))) TS_LDKCOption_MaxDustHTLCExposureZ_ty_from_ptr(uint64_t ptr) {
7422         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7423         switch(obj->tag) {
7424                 case LDKCOption_MaxDustHTLCExposureZ_Some: return 0;
7425                 case LDKCOption_MaxDustHTLCExposureZ_None: return 1;
7426                 default: abort();
7427         }
7428 }
7429 uint64_t __attribute__((export_name("TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some"))) TS_LDKCOption_MaxDustHTLCExposureZ_Some_get_some(uint64_t ptr) {
7430         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
7431         assert(obj->tag == LDKCOption_MaxDustHTLCExposureZ_Some);
7432                         uint64_t some_ref = tag_ptr(&obj->some, false);
7433         return some_ref;
7434 }
7435 uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) {
7436         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7437         switch(obj->tag) {
7438                 case LDKCOption_APIErrorZ_Some: return 0;
7439                 case LDKCOption_APIErrorZ_None: return 1;
7440                 default: abort();
7441         }
7442 }
7443 uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) {
7444         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
7445         assert(obj->tag == LDKCOption_APIErrorZ_Some);
7446                         uint64_t some_ref = tag_ptr(&obj->some, false);
7447         return some_ref;
7448 }
7449 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7450 CHECK(owner->result_ok);
7451         return COption_APIErrorZ_clone(&*owner->contents.result);
7452 }
7453 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) {
7454         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7455         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
7456         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
7457         uint64_t ret_ref = tag_ptr(ret_copy, true);
7458         return ret_ref;
7459 }
7460
7461 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
7462 CHECK(!owner->result_ok);
7463         return DecodeError_clone(&*owner->contents.err);
7464 }
7465 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) {
7466         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
7467         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7468         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
7469         uint64_t ret_ref = tag_ptr(ret_copy, true);
7470         return ret_ref;
7471 }
7472
7473 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
7474         LDKBigSize ret = *owner->contents.result;
7475         ret.is_owned = false;
7476         return ret;
7477 }
7478 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_ok"))) TS_CResult_BigSizeDecodeErrorZ_get_ok(uint64_t owner) {
7479         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
7480         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
7481         uint64_t ret_ref = 0;
7482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7484         return ret_ref;
7485 }
7486
7487 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
7488 CHECK(!owner->result_ok);
7489         return DecodeError_clone(&*owner->contents.err);
7490 }
7491 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_get_err"))) TS_CResult_BigSizeDecodeErrorZ_get_err(uint64_t owner) {
7492         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
7493         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7494         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
7495         uint64_t ret_ref = tag_ptr(ret_copy, true);
7496         return ret_ref;
7497 }
7498
7499 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
7500         LDKHostname ret = *owner->contents.result;
7501         ret.is_owned = false;
7502         return ret;
7503 }
7504 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_ok"))) TS_CResult_HostnameDecodeErrorZ_get_ok(uint64_t owner) {
7505         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
7506         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
7507         uint64_t ret_ref = 0;
7508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7510         return ret_ref;
7511 }
7512
7513 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
7514 CHECK(!owner->result_ok);
7515         return DecodeError_clone(&*owner->contents.err);
7516 }
7517 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_get_err"))) TS_CResult_HostnameDecodeErrorZ_get_err(uint64_t owner) {
7518         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
7519         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7520         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
7521         uint64_t ret_ref = tag_ptr(ret_copy, true);
7522         return ret_ref;
7523 }
7524
7525 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
7526         LDKTransactionU16LenLimited ret = *owner->contents.result;
7527         ret.is_owned = false;
7528         return ret;
7529 }
7530 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_ok(uint64_t owner) {
7531         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
7532         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
7533         uint64_t ret_ref = 0;
7534         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7535         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7536         return ret_ref;
7537 }
7538
7539 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
7540 CHECK(!owner->result_ok);
7541         return *owner->contents.err;
7542 }
7543 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_get_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_get_err(uint64_t owner) {
7544         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
7545         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
7546 }
7547
7548 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
7549         LDKTransactionU16LenLimited ret = *owner->contents.result;
7550         ret.is_owned = false;
7551         return ret;
7552 }
7553 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(uint64_t owner) {
7554         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
7555         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
7556         uint64_t ret_ref = 0;
7557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7559         return ret_ref;
7560 }
7561
7562 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
7563 CHECK(!owner->result_ok);
7564         return DecodeError_clone(&*owner->contents.err);
7565 }
7566 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(uint64_t owner) {
7567         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
7568         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7569         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
7570         uint64_t ret_ref = tag_ptr(ret_copy, true);
7571         return ret_ref;
7572 }
7573
7574 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
7575         LDKUntrustedString ret = *owner->contents.result;
7576         ret.is_owned = false;
7577         return ret;
7578 }
7579 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_get_ok(uint64_t owner) {
7580         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
7581         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
7582         uint64_t ret_ref = 0;
7583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7585         return ret_ref;
7586 }
7587
7588 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
7589 CHECK(!owner->result_ok);
7590         return DecodeError_clone(&*owner->contents.err);
7591 }
7592 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_get_err"))) TS_CResult_UntrustedStringDecodeErrorZ_get_err(uint64_t owner) {
7593         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
7594         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7595         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
7596         uint64_t ret_ref = tag_ptr(ret_copy, true);
7597         return ret_ref;
7598 }
7599
7600 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7601         LDKOutPoint ret = *owner->contents.result;
7602         ret.is_owned = false;
7603         return ret;
7604 }
7605 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_ok"))) TS_CResult_OutPointDecodeErrorZ_get_ok(uint64_t owner) {
7606         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
7607         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
7608         uint64_t ret_ref = 0;
7609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7611         return ret_ref;
7612 }
7613
7614 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
7615 CHECK(!owner->result_ok);
7616         return DecodeError_clone(&*owner->contents.err);
7617 }
7618 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_get_err"))) TS_CResult_OutPointDecodeErrorZ_get_err(uint64_t owner) {
7619         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
7620         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7621         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
7622         uint64_t ret_ref = tag_ptr(ret_copy, true);
7623         return ret_ref;
7624 }
7625
7626 typedef struct LDKType_JCalls {
7627         atomic_size_t refcnt;
7628         uint32_t instance_ptr;
7629 } LDKType_JCalls;
7630 static void LDKType_JCalls_free(void* this_arg) {
7631         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7632         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7633                 FREE(j_calls);
7634         }
7635 }
7636 uint16_t type_id_LDKType_jcall(const void* this_arg) {
7637         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7638         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0);
7639 }
7640 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
7641         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7642         jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, 0, 0, 0, 0, 0, 0);
7643         LDKStr ret_conv = str_ref_to_owned_c(ret);
7644         return ret_conv;
7645 }
7646 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
7647         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
7648         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 0, 0, 0, 0, 0, 0);
7649         LDKCVec_u8Z ret_ref;
7650         ret_ref.datalen = ret->arr_len;
7651         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
7652         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
7653         return ret_ref;
7654 }
7655 static void LDKType_JCalls_cloned(LDKType* new_obj) {
7656         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
7657         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7658 }
7659 static inline LDKType LDKType_init (JSValue o) {
7660         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
7661         atomic_init(&calls->refcnt, 1);
7662         calls->instance_ptr = o;
7663
7664         LDKType ret = {
7665                 .this_arg = (void*) calls,
7666                 .type_id = type_id_LDKType_jcall,
7667                 .debug_str = debug_str_LDKType_jcall,
7668                 .write = write_LDKType_jcall,
7669                 .cloned = LDKType_JCalls_cloned,
7670                 .free = LDKType_JCalls_free,
7671         };
7672         return ret;
7673 }
7674 uint64_t  __attribute__((export_name("TS_LDKType_new"))) TS_LDKType_new(JSValue o) {
7675         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
7676         *res_ptr = LDKType_init(o);
7677         return tag_ptr(res_ptr, true);
7678 }
7679 int16_t  __attribute__((export_name("TS_Type_type_id"))) TS_Type_type_id(uint64_t this_arg) {
7680         void* this_arg_ptr = untag_ptr(this_arg);
7681         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7682         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7683         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
7684         return ret_conv;
7685 }
7686
7687 jstring  __attribute__((export_name("TS_Type_debug_str"))) TS_Type_debug_str(uint64_t this_arg) {
7688         void* this_arg_ptr = untag_ptr(this_arg);
7689         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7690         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7691         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
7692         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7693         Str_free(ret_str);
7694         return ret_conv;
7695 }
7696
7697 int8_tArray  __attribute__((export_name("TS_Type_write"))) TS_Type_write(uint64_t this_arg) {
7698         void* this_arg_ptr = untag_ptr(this_arg);
7699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
7700         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
7701         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
7702         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7703         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7704         CVec_u8Z_free(ret_var);
7705         return ret_arr;
7706 }
7707
7708 uint32_t __attribute__((export_name("TS_LDKCOption_TypeZ_ty_from_ptr"))) TS_LDKCOption_TypeZ_ty_from_ptr(uint64_t ptr) {
7709         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7710         switch(obj->tag) {
7711                 case LDKCOption_TypeZ_Some: return 0;
7712                 case LDKCOption_TypeZ_None: return 1;
7713                 default: abort();
7714         }
7715 }
7716 uint64_t __attribute__((export_name("TS_LDKCOption_TypeZ_Some_get_some"))) TS_LDKCOption_TypeZ_Some_get_some(uint64_t ptr) {
7717         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
7718         assert(obj->tag == LDKCOption_TypeZ_Some);
7719                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
7720                         *some_ret = Type_clone(&obj->some);
7721         return tag_ptr(some_ret, true);
7722 }
7723 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7724 CHECK(owner->result_ok);
7725         return COption_TypeZ_clone(&*owner->contents.result);
7726 }
7727 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_get_ok(uint64_t owner) {
7728         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7729         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
7730         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
7731         uint64_t ret_ref = tag_ptr(ret_copy, true);
7732         return ret_ref;
7733 }
7734
7735 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
7736 CHECK(!owner->result_ok);
7737         return DecodeError_clone(&*owner->contents.err);
7738 }
7739 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_get_err"))) TS_CResult_COption_TypeZDecodeErrorZ_get_err(uint64_t owner) {
7740         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
7741         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7742         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
7743         uint64_t ret_ref = tag_ptr(ret_copy, true);
7744         return ret_ref;
7745 }
7746
7747 uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPaymentError_ty_from_ptr(uint64_t ptr) {
7748         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7749         switch(obj->tag) {
7750                 case LDKPaymentError_Invoice: return 0;
7751                 case LDKPaymentError_Sending: return 1;
7752                 default: abort();
7753         }
7754 }
7755 jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) TS_LDKPaymentError_Invoice_get_invoice(uint64_t ptr) {
7756         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7757         assert(obj->tag == LDKPaymentError_Invoice);
7758                         LDKStr invoice_str = obj->invoice;
7759                         jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len);
7760         return invoice_conv;
7761 }
7762 uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) {
7763         LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr);
7764         assert(obj->tag == LDKPaymentError_Sending);
7765                         uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending);
7766         return sending_conv;
7767 }
7768 static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7769 CHECK(owner->result_ok);
7770         return ThirtyTwoBytes_clone(&*owner->contents.result);
7771 }
7772 int8_tArray  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_ok"))) TS_CResult_PaymentIdPaymentErrorZ_get_ok(uint64_t owner) {
7773         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7774         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7775         memcpy(ret_arr->elems, CResult_PaymentIdPaymentErrorZ_get_ok(owner_conv).data, 32);
7776         return ret_arr;
7777 }
7778
7779 static inline struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){
7780 CHECK(!owner->result_ok);
7781         return PaymentError_clone(&*owner->contents.err);
7782 }
7783 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err"))) TS_CResult_PaymentIdPaymentErrorZ_get_err(uint64_t owner) {
7784         LDKCResult_PaymentIdPaymentErrorZ* owner_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(owner);
7785         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7786         *ret_copy = CResult_PaymentIdPaymentErrorZ_get_err(owner_conv);
7787         uint64_t ret_ref = tag_ptr(ret_copy, true);
7788         return ret_ref;
7789 }
7790
7791 static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
7792 CHECK(owner->result_ok);
7793         return *owner->contents.result;
7794 }
7795 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) {
7796         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
7797         CResult_NonePaymentErrorZ_get_ok(owner_conv);
7798 }
7799
7800 static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){
7801 CHECK(!owner->result_ok);
7802         return PaymentError_clone(&*owner->contents.err);
7803 }
7804 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) {
7805         LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner);
7806         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
7807         *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv);
7808         uint64_t ret_ref = tag_ptr(ret_copy, true);
7809         return ret_ref;
7810 }
7811
7812 static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7813 CHECK(owner->result_ok);
7814         return *owner->contents.result;
7815 }
7816 jstring  __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) {
7817         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7818         LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv);
7819         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
7820         return ret_conv;
7821 }
7822
7823 static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){
7824 CHECK(!owner->result_ok);
7825         return *owner->contents.err;
7826 }
7827 uint32_t  __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) {
7828         LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner);
7829         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv));
7830         return ret_conv;
7831 }
7832
7833 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7834         LDKChannelMonitorUpdate ret = *owner->contents.result;
7835         ret.is_owned = false;
7836         return ret;
7837 }
7838 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7839         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7840         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
7841         uint64_t ret_ref = 0;
7842         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7843         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7844         return ret_ref;
7845 }
7846
7847 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
7848 CHECK(!owner->result_ok);
7849         return DecodeError_clone(&*owner->contents.err);
7850 }
7851 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) {
7852         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
7853         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7854         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
7855         uint64_t ret_ref = tag_ptr(ret_copy, true);
7856         return ret_ref;
7857 }
7858
7859 uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) {
7860         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7861         switch(obj->tag) {
7862                 case LDKCOption_MonitorEventZ_Some: return 0;
7863                 case LDKCOption_MonitorEventZ_None: return 1;
7864                 default: abort();
7865         }
7866 }
7867 uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) {
7868         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
7869         assert(obj->tag == LDKCOption_MonitorEventZ_Some);
7870                         uint64_t some_ref = tag_ptr(&obj->some, false);
7871         return some_ref;
7872 }
7873 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7874 CHECK(owner->result_ok);
7875         return COption_MonitorEventZ_clone(&*owner->contents.result);
7876 }
7877 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) {
7878         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7879         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
7880         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
7881         uint64_t ret_ref = tag_ptr(ret_copy, true);
7882         return ret_ref;
7883 }
7884
7885 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
7886 CHECK(!owner->result_ok);
7887         return DecodeError_clone(&*owner->contents.err);
7888 }
7889 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) {
7890         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
7891         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7892         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
7893         uint64_t ret_ref = tag_ptr(ret_copy, true);
7894         return ret_ref;
7895 }
7896
7897 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7898         LDKHTLCUpdate ret = *owner->contents.result;
7899         ret.is_owned = false;
7900         return ret;
7901 }
7902 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) {
7903         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7904         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
7905         uint64_t ret_ref = 0;
7906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7908         return ret_ref;
7909 }
7910
7911 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
7912 CHECK(!owner->result_ok);
7913         return DecodeError_clone(&*owner->contents.err);
7914 }
7915 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) {
7916         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
7917         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7918         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
7919         uint64_t ret_ref = tag_ptr(ret_copy, true);
7920         return ret_ref;
7921 }
7922
7923 static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7924         LDKOutPoint ret = owner->a;
7925         ret.is_owned = false;
7926         return ret;
7927 }
7928 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) {
7929         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7930         LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv);
7931         uint64_t ret_ref = 0;
7932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7934         return ret_ref;
7935 }
7936
7937 static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){
7938         return CVec_u8Z_clone(&owner->b);
7939 }
7940 int8_tArray  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) {
7941         LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner);
7942         LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv);
7943         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7944         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7945         CVec_u8Z_free(ret_var);
7946         return ret_arr;
7947 }
7948
7949 static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7950         return owner->a;
7951 }
7952 int32_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) {
7953         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7954         int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv);
7955         return ret_conv;
7956 }
7957
7958 static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){
7959         return CVec_u8Z_clone(&owner->b);
7960 }
7961 int8_tArray  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) {
7962         LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner);
7963         LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv);
7964         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
7965         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
7966         CVec_u8Z_free(ret_var);
7967         return ret_arr;
7968 }
7969
7970 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
7971         LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
7972         for (size_t i = 0; i < ret.datalen; i++) {
7973                 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
7974         }
7975         return ret;
7976 }
7977 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7978         return ThirtyTwoBytes_clone(&owner->a);
7979 }
7980 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) {
7981         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7982         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
7983         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32);
7984         return ret_arr;
7985 }
7986
7987 static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){
7988         return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b);
7989 }
7990 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) {
7991         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner);
7992         LDKCVec_C2Tuple_u32ScriptZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(owner_conv);
7993         uint64_tArray ret_arr = NULL;
7994         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
7995         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
7996         for (size_t v = 0; v < ret_var.datalen; v++) {
7997                 LDKC2Tuple_u32ScriptZ* ret_conv_21_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
7998                 *ret_conv_21_conv = ret_var.data[v];
7999                 ret_arr_ptr[v] = tag_ptr(ret_conv_21_conv, true);
8000         }
8001         
8002         FREE(ret_var.data);
8003         return ret_arr;
8004 }
8005
8006 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
8007         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ clone bytes"), .datalen = orig->datalen };
8008         for (size_t i = 0; i < ret.datalen; i++) {
8009                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
8010         }
8011         return ret;
8012 }
8013 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8014         return owner->a;
8015 }
8016 int32_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_a"))) TS_C2Tuple_u32TxOutZ_get_a(uint64_t owner) {
8017         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8018         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
8019         return ret_conv;
8020 }
8021
8022 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
8023         return TxOut_clone(&owner->b);
8024 }
8025 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_get_b"))) TS_C2Tuple_u32TxOutZ_get_b(uint64_t owner) {
8026         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
8027         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
8028         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
8029         return tag_ptr(ret_ref, true);
8030 }
8031
8032 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
8033         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
8034         for (size_t i = 0; i < ret.datalen; i++) {
8035                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
8036         }
8037         return ret;
8038 }
8039 static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8040         return ThirtyTwoBytes_clone(&owner->a);
8041 }
8042 int8_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(uint64_t owner) {
8043         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8044         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8045         memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data, 32);
8046         return ret_arr;
8047 }
8048
8049 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
8050         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
8051 }
8052 uint64_tArray  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(uint64_t owner) {
8053         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
8054         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
8055         uint64_tArray ret_arr = NULL;
8056         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
8057         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
8058         for (size_t u = 0; u < ret_var.datalen; u++) {
8059                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
8060                 *ret_conv_20_conv = ret_var.data[u];
8061                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
8062         }
8063         
8064         FREE(ret_var.data);
8065         return ret_arr;
8066 }
8067
8068 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
8069         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
8070         for (size_t i = 0; i < ret.datalen; i++) {
8071                 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
8072         }
8073         return ret;
8074 }
8075 uint32_t __attribute__((export_name("TS_LDKBalance_ty_from_ptr"))) TS_LDKBalance_ty_from_ptr(uint64_t ptr) {
8076         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8077         switch(obj->tag) {
8078                 case LDKBalance_ClaimableOnChannelClose: return 0;
8079                 case LDKBalance_ClaimableAwaitingConfirmations: return 1;
8080                 case LDKBalance_ContentiousClaimable: return 2;
8081                 case LDKBalance_MaybeTimeoutClaimableHTLC: return 3;
8082                 case LDKBalance_MaybePreimageClaimableHTLC: return 4;
8083                 case LDKBalance_CounterpartyRevokedOutputClaimable: return 5;
8084                 default: abort();
8085         }
8086 }
8087 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis"))) TS_LDKBalance_ClaimableOnChannelClose_get_amount_satoshis(uint64_t ptr) {
8088         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8089         assert(obj->tag == LDKBalance_ClaimableOnChannelClose);
8090                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
8091         return amount_satoshis_conv;
8092 }
8093 int64_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_amount_satoshis(uint64_t ptr) {
8094         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8095         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
8096                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
8097         return amount_satoshis_conv;
8098 }
8099 int32_t __attribute__((export_name("TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height"))) TS_LDKBalance_ClaimableAwaitingConfirmations_get_confirmation_height(uint64_t ptr) {
8100         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8101         assert(obj->tag == LDKBalance_ClaimableAwaitingConfirmations);
8102                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
8103         return confirmation_height_conv;
8104 }
8105 int64_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_amount_satoshis"))) TS_LDKBalance_ContentiousClaimable_get_amount_satoshis(uint64_t ptr) {
8106         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8107         assert(obj->tag == LDKBalance_ContentiousClaimable);
8108                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
8109         return amount_satoshis_conv;
8110 }
8111 int32_t __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_timeout_height"))) TS_LDKBalance_ContentiousClaimable_get_timeout_height(uint64_t ptr) {
8112         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8113         assert(obj->tag == LDKBalance_ContentiousClaimable);
8114                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
8115         return timeout_height_conv;
8116 }
8117 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_hash"))) TS_LDKBalance_ContentiousClaimable_get_payment_hash(uint64_t ptr) {
8118         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8119         assert(obj->tag == LDKBalance_ContentiousClaimable);
8120                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8121                         memcpy(payment_hash_arr->elems, obj->contentious_claimable.payment_hash.data, 32);
8122         return payment_hash_arr;
8123 }
8124 int8_tArray __attribute__((export_name("TS_LDKBalance_ContentiousClaimable_get_payment_preimage"))) TS_LDKBalance_ContentiousClaimable_get_payment_preimage(uint64_t ptr) {
8125         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8126         assert(obj->tag == LDKBalance_ContentiousClaimable);
8127                         int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__);
8128                         memcpy(payment_preimage_arr->elems, obj->contentious_claimable.payment_preimage.data, 32);
8129         return payment_preimage_arr;
8130 }
8131 int64_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
8132         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8133         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8134                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
8135         return amount_satoshis_conv;
8136 }
8137 int32_t __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_claimable_height(uint64_t ptr) {
8138         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8139         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8140                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
8141         return claimable_height_conv;
8142 }
8143 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybeTimeoutClaimableHTLC_get_payment_hash(uint64_t ptr) {
8144         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8145         assert(obj->tag == LDKBalance_MaybeTimeoutClaimableHTLC);
8146                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8147                         memcpy(payment_hash_arr->elems, obj->maybe_timeout_claimable_htlc.payment_hash.data, 32);
8148         return payment_hash_arr;
8149 }
8150 int64_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_amount_satoshis(uint64_t ptr) {
8151         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8152         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8153                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
8154         return amount_satoshis_conv;
8155 }
8156 int32_t __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_expiry_height(uint64_t ptr) {
8157         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8158         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8159                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
8160         return expiry_height_conv;
8161 }
8162 int8_tArray __attribute__((export_name("TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash"))) TS_LDKBalance_MaybePreimageClaimableHTLC_get_payment_hash(uint64_t ptr) {
8163         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8164         assert(obj->tag == LDKBalance_MaybePreimageClaimableHTLC);
8165                         int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__);
8166                         memcpy(payment_hash_arr->elems, obj->maybe_preimage_claimable_htlc.payment_hash.data, 32);
8167         return payment_hash_arr;
8168 }
8169 int64_t __attribute__((export_name("TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis"))) TS_LDKBalance_CounterpartyRevokedOutputClaimable_get_amount_satoshis(uint64_t ptr) {
8170         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
8171         assert(obj->tag == LDKBalance_CounterpartyRevokedOutputClaimable);
8172                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
8173         return amount_satoshis_conv;
8174 }
8175 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
8176         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
8177         for (size_t i = 0; i < ret.datalen; i++) {
8178                 ret.data[i] = Balance_clone(&orig->data[i]);
8179         }
8180         return ret;
8181 }
8182 static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelMonitorZ_get_a(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
8183         return ThirtyTwoBytes_clone(&owner->a);
8184 }
8185 int8_tArray  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_a"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_a(uint64_t owner) {
8186         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
8187         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
8188         memcpy(ret_arr->elems, C2Tuple_BlockHashChannelMonitorZ_get_a(owner_conv).data, 32);
8189         return ret_arr;
8190 }
8191
8192 static inline struct LDKChannelMonitor C2Tuple_BlockHashChannelMonitorZ_get_b(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR owner){
8193         LDKChannelMonitor ret = owner->b;
8194         ret.is_owned = false;
8195         return ret;
8196 }
8197 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_get_b"))) TS_C2Tuple_BlockHashChannelMonitorZ_get_b(uint64_t owner) {
8198         LDKC2Tuple_BlockHashChannelMonitorZ* owner_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(owner);
8199         LDKChannelMonitor ret_var = C2Tuple_BlockHashChannelMonitorZ_get_b(owner_conv);
8200         uint64_t ret_ref = 0;
8201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8203         return ret_ref;
8204 }
8205
8206 static inline struct LDKC2Tuple_BlockHashChannelMonitorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8207 CHECK(owner->result_ok);
8208         return C2Tuple_BlockHashChannelMonitorZ_clone(&*owner->contents.result);
8209 }
8210 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(uint64_t owner) {
8211         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8212         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
8213         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
8214         return tag_ptr(ret_conv, true);
8215 }
8216
8217 static inline struct LDKDecodeError CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
8218 CHECK(!owner->result_ok);
8219         return DecodeError_clone(&*owner->contents.err);
8220 }
8221 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(uint64_t owner) {
8222         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
8223         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8224         *ret_copy = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(owner_conv);
8225         uint64_t ret_ref = tag_ptr(ret_copy, true);
8226         return ret_ref;
8227 }
8228
8229 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8230         return owner->a;
8231 }
8232 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_a"))) TS_C2Tuple_PublicKeyTypeZ_get_a(uint64_t owner) {
8233         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8234         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8235         memcpy(ret_arr->elems, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form, 33);
8236         return ret_arr;
8237 }
8238
8239 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
8240         return Type_clone(&owner->b);
8241 }
8242 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_get_b"))) TS_C2Tuple_PublicKeyTypeZ_get_b(uint64_t owner) {
8243         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
8244         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
8245         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
8246         return tag_ptr(ret_ret, true);
8247 }
8248
8249 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
8250         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
8251         for (size_t i = 0; i < ret.datalen; i++) {
8252                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
8253         }
8254         return ret;
8255 }
8256 typedef struct LDKCustomOnionMessageContents_JCalls {
8257         atomic_size_t refcnt;
8258         uint32_t instance_ptr;
8259 } LDKCustomOnionMessageContents_JCalls;
8260 static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) {
8261         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
8262         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8263                 FREE(j_calls);
8264         }
8265 }
8266 uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
8267         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
8268         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0);
8269 }
8270 LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) {
8271         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg;
8272         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, 0, 0, 0, 0, 0, 0);
8273         LDKCVec_u8Z ret_ref;
8274         ret_ref.datalen = ret->arr_len;
8275         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
8276         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
8277         return ret_ref;
8278 }
8279 static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) {
8280         LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg;
8281         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8282 }
8283 static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JSValue o) {
8284         LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls");
8285         atomic_init(&calls->refcnt, 1);
8286         calls->instance_ptr = o;
8287
8288         LDKCustomOnionMessageContents ret = {
8289                 .this_arg = (void*) calls,
8290                 .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall,
8291                 .write = write_LDKCustomOnionMessageContents_jcall,
8292                 .cloned = LDKCustomOnionMessageContents_JCalls_cloned,
8293                 .free = LDKCustomOnionMessageContents_JCalls_free,
8294         };
8295         return ret;
8296 }
8297 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageContents_new"))) TS_LDKCustomOnionMessageContents_new(JSValue o) {
8298         LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
8299         *res_ptr = LDKCustomOnionMessageContents_init(o);
8300         return tag_ptr(res_ptr, true);
8301 }
8302 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_tlv_type"))) TS_CustomOnionMessageContents_tlv_type(uint64_t this_arg) {
8303         void* this_arg_ptr = untag_ptr(this_arg);
8304         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8305         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
8306         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
8307         return ret_conv;
8308 }
8309
8310 int8_tArray  __attribute__((export_name("TS_CustomOnionMessageContents_write"))) TS_CustomOnionMessageContents_write(uint64_t this_arg) {
8311         void* this_arg_ptr = untag_ptr(this_arg);
8312         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
8313         LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr;
8314         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
8315         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8316         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8317         CVec_u8Z_free(ret_var);
8318         return ret_arr;
8319 }
8320
8321 uint32_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr"))) TS_LDKCOption_CustomOnionMessageContentsZ_ty_from_ptr(uint64_t ptr) {
8322         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
8323         switch(obj->tag) {
8324                 case LDKCOption_CustomOnionMessageContentsZ_Some: return 0;
8325                 case LDKCOption_CustomOnionMessageContentsZ_None: return 1;
8326                 default: abort();
8327         }
8328 }
8329 uint64_t __attribute__((export_name("TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some"))) TS_LDKCOption_CustomOnionMessageContentsZ_Some_get_some(uint64_t ptr) {
8330         LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr);
8331         assert(obj->tag == LDKCOption_CustomOnionMessageContentsZ_Some);
8332                         LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
8333                         *some_ret = CustomOnionMessageContents_clone(&obj->some);
8334         return tag_ptr(some_ret, true);
8335 }
8336 static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8337 CHECK(owner->result_ok);
8338         return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result);
8339 }
8340 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(uint64_t owner) {
8341         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8342         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
8343         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
8344         uint64_t ret_ref = tag_ptr(ret_copy, true);
8345         return ret_ref;
8346 }
8347
8348 static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
8349 CHECK(!owner->result_ok);
8350         return DecodeError_clone(&*owner->contents.err);
8351 }
8352 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(uint64_t owner) {
8353         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
8354         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8355         *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
8356         uint64_t ret_ref = tag_ptr(ret_copy, true);
8357         return ret_ref;
8358 }
8359
8360 uint32_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_ty_from_ptr"))) TS_LDKCOption_NetAddressZ_ty_from_ptr(uint64_t ptr) {
8361         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
8362         switch(obj->tag) {
8363                 case LDKCOption_NetAddressZ_Some: return 0;
8364                 case LDKCOption_NetAddressZ_None: return 1;
8365                 default: abort();
8366         }
8367 }
8368 uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) TS_LDKCOption_NetAddressZ_Some_get_some(uint64_t ptr) {
8369         LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)untag_ptr(ptr);
8370         assert(obj->tag == LDKCOption_NetAddressZ_Some);
8371                         uint64_t some_ref = tag_ptr(&obj->some, false);
8372         return some_ref;
8373 }
8374 static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
8375         return owner->a;
8376 }
8377 int8_tArray  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(uint64_t owner) {
8378         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
8379         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
8380         memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form, 33);
8381         return ret_arr;
8382 }
8383
8384 static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){
8385         return COption_NetAddressZ_clone(&owner->b);
8386 }
8387 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(uint64_t owner) {
8388         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner);
8389         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
8390         *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv);
8391         uint64_t ret_ref = tag_ptr(ret_copy, true);
8392         return ret_ref;
8393 }
8394
8395 static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) {
8396         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen };
8397         for (size_t i = 0; i < ret.datalen; i++) {
8398                 ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]);
8399         }
8400         return ret;
8401 }
8402 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8403 CHECK(owner->result_ok);
8404         return CVec_u8Z_clone(&*owner->contents.result);
8405 }
8406 int8_tArray  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_ok(uint64_t owner) {
8407         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8408         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
8409         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
8410         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
8411         CVec_u8Z_free(ret_var);
8412         return ret_arr;
8413 }
8414
8415 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
8416         LDKPeerHandleError ret = *owner->contents.err;
8417         ret.is_owned = false;
8418         return ret;
8419 }
8420 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_get_err(uint64_t owner) {
8421         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
8422         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
8423         uint64_t ret_ref = 0;
8424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8426         return ret_ref;
8427 }
8428
8429 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8430 CHECK(owner->result_ok);
8431         return *owner->contents.result;
8432 }
8433 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_ok"))) TS_CResult_NonePeerHandleErrorZ_get_ok(uint64_t owner) {
8434         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8435         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
8436 }
8437
8438 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
8439         LDKPeerHandleError ret = *owner->contents.err;
8440         ret.is_owned = false;
8441         return ret;
8442 }
8443 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_get_err"))) TS_CResult_NonePeerHandleErrorZ_get_err(uint64_t owner) {
8444         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
8445         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
8446         uint64_t ret_ref = 0;
8447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8449         return ret_ref;
8450 }
8451
8452 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8453 CHECK(owner->result_ok);
8454         return *owner->contents.result;
8455 }
8456 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_ok"))) TS_CResult_boolPeerHandleErrorZ_get_ok(uint64_t owner) {
8457         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8458         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
8459         return ret_conv;
8460 }
8461
8462 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
8463         LDKPeerHandleError ret = *owner->contents.err;
8464         ret.is_owned = false;
8465         return ret;
8466 }
8467 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_get_err"))) TS_CResult_boolPeerHandleErrorZ_get_err(uint64_t owner) {
8468         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
8469         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
8470         uint64_t ret_ref = 0;
8471         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8472         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8473         return ret_ref;
8474 }
8475
8476 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
8477         LDKOnionMessagePath ret = *owner->contents.result;
8478         ret.is_owned = false;
8479         return ret;
8480 }
8481 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_ok"))) TS_CResult_OnionMessagePathNoneZ_get_ok(uint64_t owner) {
8482         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
8483         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
8484         uint64_t ret_ref = 0;
8485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8487         return ret_ref;
8488 }
8489
8490 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
8491 CHECK(!owner->result_ok);
8492         return *owner->contents.err;
8493 }
8494 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_get_err"))) TS_CResult_OnionMessagePathNoneZ_get_err(uint64_t owner) {
8495         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
8496         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
8497 }
8498
8499 uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendError_ty_from_ptr(uint64_t ptr) {
8500         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
8501         switch(obj->tag) {
8502                 case LDKSendError_Secp256k1: return 0;
8503                 case LDKSendError_TooBigPacket: return 1;
8504                 case LDKSendError_TooFewBlindedHops: return 2;
8505                 case LDKSendError_InvalidFirstHop: return 3;
8506                 case LDKSendError_InvalidMessage: return 4;
8507                 case LDKSendError_BufferFull: return 5;
8508                 case LDKSendError_GetNodeIdFailed: return 6;
8509                 case LDKSendError_BlindedPathAdvanceFailed: return 7;
8510                 default: abort();
8511         }
8512 }
8513 uint32_t __attribute__((export_name("TS_LDKSendError_Secp256k1_get_secp256k1"))) TS_LDKSendError_Secp256k1_get_secp256k1(uint64_t ptr) {
8514         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
8515         assert(obj->tag == LDKSendError_Secp256k1);
8516                         uint32_t secp256k1_conv = LDKSecp256k1Error_to_js(obj->secp256k1);
8517         return secp256k1_conv;
8518 }
8519 static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
8520 CHECK(owner->result_ok);
8521         return *owner->contents.result;
8522 }
8523 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_ok"))) TS_CResult_NoneSendErrorZ_get_ok(uint64_t owner) {
8524         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
8525         CResult_NoneSendErrorZ_get_ok(owner_conv);
8526 }
8527
8528 static inline struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){
8529 CHECK(!owner->result_ok);
8530         return SendError_clone(&*owner->contents.err);
8531 }
8532 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_get_err"))) TS_CResult_NoneSendErrorZ_get_err(uint64_t owner) {
8533         LDKCResult_NoneSendErrorZ* owner_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(owner);
8534         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
8535         *ret_copy = CResult_NoneSendErrorZ_get_err(owner_conv);
8536         uint64_t ret_ref = tag_ptr(ret_copy, true);
8537         return ret_ref;
8538 }
8539
8540 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
8541         LDKBlindedPath ret = *owner->contents.result;
8542         ret.is_owned = false;
8543         return ret;
8544 }
8545 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) {
8546         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
8547         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
8548         uint64_t ret_ref = 0;
8549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8551         return ret_ref;
8552 }
8553
8554 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
8555 CHECK(!owner->result_ok);
8556         return *owner->contents.err;
8557 }
8558 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) {
8559         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
8560         CResult_BlindedPathNoneZ_get_err(owner_conv);
8561 }
8562
8563 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
8564         LDKBlindedPath ret = *owner->contents.result;
8565         ret.is_owned = false;
8566         return ret;
8567 }
8568 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) {
8569         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
8570         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
8571         uint64_t ret_ref = 0;
8572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8574         return ret_ref;
8575 }
8576
8577 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
8578 CHECK(!owner->result_ok);
8579         return DecodeError_clone(&*owner->contents.err);
8580 }
8581 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) {
8582         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
8583         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8584         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
8585         uint64_t ret_ref = tag_ptr(ret_copy, true);
8586         return ret_ref;
8587 }
8588
8589 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
8590         LDKBlindedHop ret = *owner->contents.result;
8591         ret.is_owned = false;
8592         return ret;
8593 }
8594 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) {
8595         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
8596         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
8597         uint64_t ret_ref = 0;
8598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8600         return ret_ref;
8601 }
8602
8603 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
8604 CHECK(!owner->result_ok);
8605         return DecodeError_clone(&*owner->contents.err);
8606 }
8607 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) {
8608         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
8609         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8610         *ret_copy = CResult_BlindedHopDecodeErrorZ_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_LDKGraphSyncError_ty_from_ptr"))) TS_LDKGraphSyncError_ty_from_ptr(uint64_t ptr) {
8616         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8617         switch(obj->tag) {
8618                 case LDKGraphSyncError_DecodeError: return 0;
8619                 case LDKGraphSyncError_LightningError: return 1;
8620                 default: abort();
8621         }
8622 }
8623 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_DecodeError_get_decode_error"))) TS_LDKGraphSyncError_DecodeError_get_decode_error(uint64_t ptr) {
8624         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8625         assert(obj->tag == LDKGraphSyncError_DecodeError);
8626                         uint64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
8627         return decode_error_ref;
8628 }
8629 uint64_t __attribute__((export_name("TS_LDKGraphSyncError_LightningError_get_lightning_error"))) TS_LDKGraphSyncError_LightningError_get_lightning_error(uint64_t ptr) {
8630         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
8631         assert(obj->tag == LDKGraphSyncError_LightningError);
8632                         LDKLightningError lightning_error_var = obj->lightning_error;
8633                         uint64_t lightning_error_ref = 0;
8634                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
8635                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
8636         return lightning_error_ref;
8637 }
8638 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8639 CHECK(owner->result_ok);
8640         return *owner->contents.result;
8641 }
8642 int32_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_ok"))) TS_CResult_u32GraphSyncErrorZ_get_ok(uint64_t owner) {
8643         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8644         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
8645         return ret_conv;
8646 }
8647
8648 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
8649 CHECK(!owner->result_ok);
8650         return GraphSyncError_clone(&*owner->contents.err);
8651 }
8652 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) TS_CResult_u32GraphSyncErrorZ_get_err(uint64_t owner) {
8653         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
8654         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
8655         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
8656         uint64_t ret_ref = tag_ptr(ret_copy, true);
8657         return ret_ref;
8658 }
8659
8660 static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
8661 CHECK(owner->result_ok);
8662         return *owner->contents.result;
8663 }
8664 void  __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) {
8665         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
8666         CResult_NoneErrorZ_get_ok(owner_conv);
8667 }
8668
8669 static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){
8670 CHECK(!owner->result_ok);
8671         return *owner->contents.err;
8672 }
8673 uint32_t  __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) {
8674         LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner);
8675         uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv));
8676         return ret_conv;
8677 }
8678
8679 uint32_t __attribute__((export_name("TS_LDKCOption_ScriptZ_ty_from_ptr"))) TS_LDKCOption_ScriptZ_ty_from_ptr(uint64_t ptr) {
8680         LDKCOption_ScriptZ *obj = (LDKCOption_ScriptZ*)untag_ptr(ptr);
8681         switch(obj->tag) {
8682                 case LDKCOption_ScriptZ_Some: return 0;
8683                 case LDKCOption_ScriptZ_None: return 1;
8684                 default: abort();
8685         }
8686 }
8687 int8_tArray __attribute__((export_name("TS_LDKCOption_ScriptZ_Some_get_some"))) TS_LDKCOption_ScriptZ_Some_get_some(uint64_t ptr) {
8688         LDKCOption_ScriptZ *obj = (LDKCOption_ScriptZ*)untag_ptr(ptr);
8689         assert(obj->tag == LDKCOption_ScriptZ_Some);
8690                         LDKCVec_u8Z some_var = obj->some;
8691                         int8_tArray some_arr = init_int8_tArray(some_var.datalen, __LINE__);
8692                         memcpy(some_arr->elems, some_var.data, some_var.datalen);
8693         return some_arr;
8694 }
8695 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
8696         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
8697         for (size_t i = 0; i < ret.datalen; i++) {
8698                 ret.data[i] = Witness_clone(&orig->data[i]);
8699         }
8700         return ret;
8701 }
8702 uint32_t __attribute__((export_name("TS_LDKCOption_i64Z_ty_from_ptr"))) TS_LDKCOption_i64Z_ty_from_ptr(uint64_t ptr) {
8703         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8704         switch(obj->tag) {
8705                 case LDKCOption_i64Z_Some: return 0;
8706                 case LDKCOption_i64Z_None: return 1;
8707                 default: abort();
8708         }
8709 }
8710 int64_t __attribute__((export_name("TS_LDKCOption_i64Z_Some_get_some"))) TS_LDKCOption_i64Z_Some_get_some(uint64_t ptr) {
8711         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
8712         assert(obj->tag == LDKCOption_i64Z_Some);
8713                         int64_t some_conv = obj->some;
8714         return some_conv;
8715 }
8716 uint32_t __attribute__((export_name("TS_LDKCOption_TxidZ_ty_from_ptr"))) TS_LDKCOption_TxidZ_ty_from_ptr(uint64_t ptr) {
8717         LDKCOption_TxidZ *obj = (LDKCOption_TxidZ*)untag_ptr(ptr);
8718         switch(obj->tag) {
8719                 case LDKCOption_TxidZ_Some: return 0;
8720                 case LDKCOption_TxidZ_None: return 1;
8721                 default: abort();
8722         }
8723 }
8724 int8_tArray __attribute__((export_name("TS_LDKCOption_TxidZ_Some_get_some"))) TS_LDKCOption_TxidZ_Some_get_some(uint64_t ptr) {
8725         LDKCOption_TxidZ *obj = (LDKCOption_TxidZ*)untag_ptr(ptr);
8726         assert(obj->tag == LDKCOption_TxidZ_Some);
8727                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
8728                         memcpy(some_arr->elems, obj->some.data, 32);
8729         return some_arr;
8730 }
8731 static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8732 CHECK(owner->result_ok);
8733         return NetAddress_clone(&*owner->contents.result);
8734 }
8735 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) {
8736         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8737         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
8738         *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv);
8739         uint64_t ret_ref = tag_ptr(ret_copy, true);
8740         return ret_ref;
8741 }
8742
8743 static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){
8744 CHECK(!owner->result_ok);
8745         return DecodeError_clone(&*owner->contents.err);
8746 }
8747 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) {
8748         LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner);
8749         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8750         *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv);
8751         uint64_t ret_ref = tag_ptr(ret_copy, true);
8752         return ret_ref;
8753 }
8754
8755 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
8756         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
8757         for (size_t i = 0; i < ret.datalen; i++) {
8758                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
8759         }
8760         return ret;
8761 }
8762 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
8763         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
8764         for (size_t i = 0; i < ret.datalen; i++) {
8765                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
8766         }
8767         return ret;
8768 }
8769 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
8770         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
8771         for (size_t i = 0; i < ret.datalen; i++) {
8772                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
8773         }
8774         return ret;
8775 }
8776 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
8777         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
8778         for (size_t i = 0; i < ret.datalen; i++) {
8779                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
8780         }
8781         return ret;
8782 }
8783 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8784         LDKAcceptChannel ret = *owner->contents.result;
8785         ret.is_owned = false;
8786         return ret;
8787 }
8788 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) {
8789         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8790         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
8791         uint64_t ret_ref = 0;
8792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8794         return ret_ref;
8795 }
8796
8797 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
8798 CHECK(!owner->result_ok);
8799         return DecodeError_clone(&*owner->contents.err);
8800 }
8801 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) {
8802         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
8803         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8804         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
8805         uint64_t ret_ref = tag_ptr(ret_copy, true);
8806         return ret_ref;
8807 }
8808
8809 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8810         LDKAcceptChannelV2 ret = *owner->contents.result;
8811         ret.is_owned = false;
8812         return ret;
8813 }
8814 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
8815         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8816         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
8817         uint64_t ret_ref = 0;
8818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8820         return ret_ref;
8821 }
8822
8823 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
8824 CHECK(!owner->result_ok);
8825         return DecodeError_clone(&*owner->contents.err);
8826 }
8827 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_get_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_get_err(uint64_t owner) {
8828         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
8829         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8830         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
8831         uint64_t ret_ref = tag_ptr(ret_copy, true);
8832         return ret_ref;
8833 }
8834
8835 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8836         LDKTxAddInput ret = *owner->contents.result;
8837         ret.is_owned = false;
8838         return ret;
8839 }
8840 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_ok"))) TS_CResult_TxAddInputDecodeErrorZ_get_ok(uint64_t owner) {
8841         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8842         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
8843         uint64_t ret_ref = 0;
8844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8846         return ret_ref;
8847 }
8848
8849 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
8850 CHECK(!owner->result_ok);
8851         return DecodeError_clone(&*owner->contents.err);
8852 }
8853 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_get_err"))) TS_CResult_TxAddInputDecodeErrorZ_get_err(uint64_t owner) {
8854         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
8855         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8856         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
8857         uint64_t ret_ref = tag_ptr(ret_copy, true);
8858         return ret_ref;
8859 }
8860
8861 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8862         LDKTxAddOutput ret = *owner->contents.result;
8863         ret.is_owned = false;
8864         return ret;
8865 }
8866 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_get_ok(uint64_t owner) {
8867         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8868         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
8869         uint64_t ret_ref = 0;
8870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8872         return ret_ref;
8873 }
8874
8875 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
8876 CHECK(!owner->result_ok);
8877         return DecodeError_clone(&*owner->contents.err);
8878 }
8879 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_get_err"))) TS_CResult_TxAddOutputDecodeErrorZ_get_err(uint64_t owner) {
8880         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
8881         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8882         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
8883         uint64_t ret_ref = tag_ptr(ret_copy, true);
8884         return ret_ref;
8885 }
8886
8887 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8888         LDKTxRemoveInput ret = *owner->contents.result;
8889         ret.is_owned = false;
8890         return ret;
8891 }
8892 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_ok(uint64_t owner) {
8893         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8894         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
8895         uint64_t ret_ref = 0;
8896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8898         return ret_ref;
8899 }
8900
8901 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
8902 CHECK(!owner->result_ok);
8903         return DecodeError_clone(&*owner->contents.err);
8904 }
8905 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_get_err(uint64_t owner) {
8906         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
8907         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8908         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
8909         uint64_t ret_ref = tag_ptr(ret_copy, true);
8910         return ret_ref;
8911 }
8912
8913 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
8914         LDKTxRemoveOutput ret = *owner->contents.result;
8915         ret.is_owned = false;
8916         return ret;
8917 }
8918 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_ok(uint64_t owner) {
8919         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
8920         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
8921         uint64_t ret_ref = 0;
8922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8924         return ret_ref;
8925 }
8926
8927 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
8928 CHECK(!owner->result_ok);
8929         return DecodeError_clone(&*owner->contents.err);
8930 }
8931 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_get_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_get_err(uint64_t owner) {
8932         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
8933         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8934         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
8935         uint64_t ret_ref = tag_ptr(ret_copy, true);
8936         return ret_ref;
8937 }
8938
8939 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
8940         LDKTxComplete ret = *owner->contents.result;
8941         ret.is_owned = false;
8942         return ret;
8943 }
8944 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_ok"))) TS_CResult_TxCompleteDecodeErrorZ_get_ok(uint64_t owner) {
8945         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
8946         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
8947         uint64_t ret_ref = 0;
8948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8950         return ret_ref;
8951 }
8952
8953 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
8954 CHECK(!owner->result_ok);
8955         return DecodeError_clone(&*owner->contents.err);
8956 }
8957 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_get_err"))) TS_CResult_TxCompleteDecodeErrorZ_get_err(uint64_t owner) {
8958         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
8959         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8960         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
8961         uint64_t ret_ref = tag_ptr(ret_copy, true);
8962         return ret_ref;
8963 }
8964
8965 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
8966         LDKTxSignatures ret = *owner->contents.result;
8967         ret.is_owned = false;
8968         return ret;
8969 }
8970 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
8971         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
8972         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
8973         uint64_t ret_ref = 0;
8974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8976         return ret_ref;
8977 }
8978
8979 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
8980 CHECK(!owner->result_ok);
8981         return DecodeError_clone(&*owner->contents.err);
8982 }
8983 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_get_err"))) TS_CResult_TxSignaturesDecodeErrorZ_get_err(uint64_t owner) {
8984         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
8985         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8986         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
8987         uint64_t ret_ref = tag_ptr(ret_copy, true);
8988         return ret_ref;
8989 }
8990
8991 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
8992         LDKTxInitRbf ret = *owner->contents.result;
8993         ret.is_owned = false;
8994         return ret;
8995 }
8996 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_get_ok(uint64_t owner) {
8997         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
8998         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(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 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
9006 CHECK(!owner->result_ok);
9007         return DecodeError_clone(&*owner->contents.err);
9008 }
9009 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_get_err"))) TS_CResult_TxInitRbfDecodeErrorZ_get_err(uint64_t owner) {
9010         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
9011         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9012         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
9013         uint64_t ret_ref = tag_ptr(ret_copy, true);
9014         return ret_ref;
9015 }
9016
9017 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9018         LDKTxAckRbf ret = *owner->contents.result;
9019         ret.is_owned = false;
9020         return ret;
9021 }
9022 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_get_ok(uint64_t owner) {
9023         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9024         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
9025         uint64_t ret_ref = 0;
9026         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9027         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9028         return ret_ref;
9029 }
9030
9031 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
9032 CHECK(!owner->result_ok);
9033         return DecodeError_clone(&*owner->contents.err);
9034 }
9035 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_get_err"))) TS_CResult_TxAckRbfDecodeErrorZ_get_err(uint64_t owner) {
9036         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
9037         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9038         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
9039         uint64_t ret_ref = tag_ptr(ret_copy, true);
9040         return ret_ref;
9041 }
9042
9043 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9044         LDKTxAbort ret = *owner->contents.result;
9045         ret.is_owned = false;
9046         return ret;
9047 }
9048 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_ok"))) TS_CResult_TxAbortDecodeErrorZ_get_ok(uint64_t owner) {
9049         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9050         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
9051         uint64_t ret_ref = 0;
9052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9054         return ret_ref;
9055 }
9056
9057 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
9058 CHECK(!owner->result_ok);
9059         return DecodeError_clone(&*owner->contents.err);
9060 }
9061 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_get_err"))) TS_CResult_TxAbortDecodeErrorZ_get_err(uint64_t owner) {
9062         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
9063         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9064         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
9065         uint64_t ret_ref = tag_ptr(ret_copy, true);
9066         return ret_ref;
9067 }
9068
9069 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9070         LDKAnnouncementSignatures ret = *owner->contents.result;
9071         ret.is_owned = false;
9072         return ret;
9073 }
9074 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) {
9075         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9076         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
9077         uint64_t ret_ref = 0;
9078         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9079         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9080         return ret_ref;
9081 }
9082
9083 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
9084 CHECK(!owner->result_ok);
9085         return DecodeError_clone(&*owner->contents.err);
9086 }
9087 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) {
9088         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
9089         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9090         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
9091         uint64_t ret_ref = tag_ptr(ret_copy, true);
9092         return ret_ref;
9093 }
9094
9095 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9096         LDKChannelReestablish ret = *owner->contents.result;
9097         ret.is_owned = false;
9098         return ret;
9099 }
9100 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) {
9101         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9102         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
9103         uint64_t ret_ref = 0;
9104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9106         return ret_ref;
9107 }
9108
9109 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
9110 CHECK(!owner->result_ok);
9111         return DecodeError_clone(&*owner->contents.err);
9112 }
9113 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) {
9114         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
9115         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9116         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
9117         uint64_t ret_ref = tag_ptr(ret_copy, true);
9118         return ret_ref;
9119 }
9120
9121 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9122         LDKClosingSigned ret = *owner->contents.result;
9123         ret.is_owned = false;
9124         return ret;
9125 }
9126 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9127         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9128         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
9129         uint64_t ret_ref = 0;
9130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9132         return ret_ref;
9133 }
9134
9135 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
9136 CHECK(!owner->result_ok);
9137         return DecodeError_clone(&*owner->contents.err);
9138 }
9139 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) {
9140         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
9141         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9142         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
9143         uint64_t ret_ref = tag_ptr(ret_copy, true);
9144         return ret_ref;
9145 }
9146
9147 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9148         LDKClosingSignedFeeRange ret = *owner->contents.result;
9149         ret.is_owned = false;
9150         return ret;
9151 }
9152 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) {
9153         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9154         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
9155         uint64_t ret_ref = 0;
9156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9158         return ret_ref;
9159 }
9160
9161 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
9162 CHECK(!owner->result_ok);
9163         return DecodeError_clone(&*owner->contents.err);
9164 }
9165 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) {
9166         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
9167         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9168         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
9169         uint64_t ret_ref = tag_ptr(ret_copy, true);
9170         return ret_ref;
9171 }
9172
9173 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9174         LDKCommitmentSigned ret = *owner->contents.result;
9175         ret.is_owned = false;
9176         return ret;
9177 }
9178 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_ok(uint64_t owner) {
9179         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9180         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
9181         uint64_t ret_ref = 0;
9182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9184         return ret_ref;
9185 }
9186
9187 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
9188 CHECK(!owner->result_ok);
9189         return DecodeError_clone(&*owner->contents.err);
9190 }
9191 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_get_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_get_err(uint64_t owner) {
9192         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
9193         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9194         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
9195         uint64_t ret_ref = tag_ptr(ret_copy, true);
9196         return ret_ref;
9197 }
9198
9199 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9200         LDKFundingCreated ret = *owner->contents.result;
9201         ret.is_owned = false;
9202         return ret;
9203 }
9204 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_get_ok(uint64_t owner) {
9205         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9206         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
9207         uint64_t ret_ref = 0;
9208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9210         return ret_ref;
9211 }
9212
9213 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
9214 CHECK(!owner->result_ok);
9215         return DecodeError_clone(&*owner->contents.err);
9216 }
9217 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_get_err"))) TS_CResult_FundingCreatedDecodeErrorZ_get_err(uint64_t owner) {
9218         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
9219         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9220         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
9221         uint64_t ret_ref = tag_ptr(ret_copy, true);
9222         return ret_ref;
9223 }
9224
9225 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9226         LDKFundingSigned ret = *owner->contents.result;
9227         ret.is_owned = false;
9228         return ret;
9229 }
9230 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_ok"))) TS_CResult_FundingSignedDecodeErrorZ_get_ok(uint64_t owner) {
9231         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9232         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
9233         uint64_t ret_ref = 0;
9234         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9235         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9236         return ret_ref;
9237 }
9238
9239 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
9240 CHECK(!owner->result_ok);
9241         return DecodeError_clone(&*owner->contents.err);
9242 }
9243 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_get_err"))) TS_CResult_FundingSignedDecodeErrorZ_get_err(uint64_t owner) {
9244         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
9245         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9246         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
9247         uint64_t ret_ref = tag_ptr(ret_copy, true);
9248         return ret_ref;
9249 }
9250
9251 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9252         LDKChannelReady ret = *owner->contents.result;
9253         ret.is_owned = false;
9254         return ret;
9255 }
9256 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_get_ok(uint64_t owner) {
9257         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9258         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
9259         uint64_t ret_ref = 0;
9260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9262         return ret_ref;
9263 }
9264
9265 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
9266 CHECK(!owner->result_ok);
9267         return DecodeError_clone(&*owner->contents.err);
9268 }
9269 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_get_err"))) TS_CResult_ChannelReadyDecodeErrorZ_get_err(uint64_t owner) {
9270         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
9271         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9272         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
9273         uint64_t ret_ref = tag_ptr(ret_copy, true);
9274         return ret_ref;
9275 }
9276
9277 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9278         LDKInit ret = *owner->contents.result;
9279         ret.is_owned = false;
9280         return ret;
9281 }
9282 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_ok"))) TS_CResult_InitDecodeErrorZ_get_ok(uint64_t owner) {
9283         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9284         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
9285         uint64_t ret_ref = 0;
9286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9288         return ret_ref;
9289 }
9290
9291 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
9292 CHECK(!owner->result_ok);
9293         return DecodeError_clone(&*owner->contents.err);
9294 }
9295 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_get_err"))) TS_CResult_InitDecodeErrorZ_get_err(uint64_t owner) {
9296         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
9297         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9298         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
9299         uint64_t ret_ref = tag_ptr(ret_copy, true);
9300         return ret_ref;
9301 }
9302
9303 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9304         LDKOpenChannel ret = *owner->contents.result;
9305         ret.is_owned = false;
9306         return ret;
9307 }
9308 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_ok"))) TS_CResult_OpenChannelDecodeErrorZ_get_ok(uint64_t owner) {
9309         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9310         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
9311         uint64_t ret_ref = 0;
9312         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9313         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9314         return ret_ref;
9315 }
9316
9317 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
9318 CHECK(!owner->result_ok);
9319         return DecodeError_clone(&*owner->contents.err);
9320 }
9321 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_get_err"))) TS_CResult_OpenChannelDecodeErrorZ_get_err(uint64_t owner) {
9322         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
9323         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9324         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
9325         uint64_t ret_ref = tag_ptr(ret_copy, true);
9326         return ret_ref;
9327 }
9328
9329 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9330         LDKOpenChannelV2 ret = *owner->contents.result;
9331         ret.is_owned = false;
9332         return ret;
9333 }
9334 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_ok(uint64_t owner) {
9335         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9336         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
9337         uint64_t ret_ref = 0;
9338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9340         return ret_ref;
9341 }
9342
9343 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
9344 CHECK(!owner->result_ok);
9345         return DecodeError_clone(&*owner->contents.err);
9346 }
9347 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_get_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_get_err(uint64_t owner) {
9348         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
9349         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9350         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
9351         uint64_t ret_ref = tag_ptr(ret_copy, true);
9352         return ret_ref;
9353 }
9354
9355 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9356         LDKRevokeAndACK ret = *owner->contents.result;
9357         ret.is_owned = false;
9358         return ret;
9359 }
9360 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_ok(uint64_t owner) {
9361         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9362         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
9363         uint64_t ret_ref = 0;
9364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9366         return ret_ref;
9367 }
9368
9369 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
9370 CHECK(!owner->result_ok);
9371         return DecodeError_clone(&*owner->contents.err);
9372 }
9373 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_get_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_get_err(uint64_t owner) {
9374         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
9375         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9376         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
9377         uint64_t ret_ref = tag_ptr(ret_copy, true);
9378         return ret_ref;
9379 }
9380
9381 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9382         LDKShutdown ret = *owner->contents.result;
9383         ret.is_owned = false;
9384         return ret;
9385 }
9386 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_ok"))) TS_CResult_ShutdownDecodeErrorZ_get_ok(uint64_t owner) {
9387         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9388         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
9389         uint64_t ret_ref = 0;
9390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9392         return ret_ref;
9393 }
9394
9395 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
9396 CHECK(!owner->result_ok);
9397         return DecodeError_clone(&*owner->contents.err);
9398 }
9399 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_get_err"))) TS_CResult_ShutdownDecodeErrorZ_get_err(uint64_t owner) {
9400         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
9401         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9402         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
9403         uint64_t ret_ref = tag_ptr(ret_copy, true);
9404         return ret_ref;
9405 }
9406
9407 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9408         LDKUpdateFailHTLC ret = *owner->contents.result;
9409         ret.is_owned = false;
9410         return ret;
9411 }
9412 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9413         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9414         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
9415         uint64_t ret_ref = 0;
9416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9418         return ret_ref;
9419 }
9420
9421 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
9422 CHECK(!owner->result_ok);
9423         return DecodeError_clone(&*owner->contents.err);
9424 }
9425 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_get_err(uint64_t owner) {
9426         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
9427         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9428         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
9429         uint64_t ret_ref = tag_ptr(ret_copy, true);
9430         return ret_ref;
9431 }
9432
9433 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9434         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
9435         ret.is_owned = false;
9436         return ret;
9437 }
9438 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9439         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9440         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
9441         uint64_t ret_ref = 0;
9442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9444         return ret_ref;
9445 }
9446
9447 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
9448 CHECK(!owner->result_ok);
9449         return DecodeError_clone(&*owner->contents.err);
9450 }
9451 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(uint64_t owner) {
9452         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
9453         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9454         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
9455         uint64_t ret_ref = tag_ptr(ret_copy, true);
9456         return ret_ref;
9457 }
9458
9459 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9460         LDKUpdateFee ret = *owner->contents.result;
9461         ret.is_owned = false;
9462         return ret;
9463 }
9464 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_get_ok(uint64_t owner) {
9465         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9466         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
9467         uint64_t ret_ref = 0;
9468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9470         return ret_ref;
9471 }
9472
9473 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
9474 CHECK(!owner->result_ok);
9475         return DecodeError_clone(&*owner->contents.err);
9476 }
9477 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_get_err"))) TS_CResult_UpdateFeeDecodeErrorZ_get_err(uint64_t owner) {
9478         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
9479         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9480         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
9481         uint64_t ret_ref = tag_ptr(ret_copy, true);
9482         return ret_ref;
9483 }
9484
9485 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9486         LDKUpdateFulfillHTLC ret = *owner->contents.result;
9487         ret.is_owned = false;
9488         return ret;
9489 }
9490 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9491         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9492         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
9493         uint64_t ret_ref = 0;
9494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9496         return ret_ref;
9497 }
9498
9499 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
9500 CHECK(!owner->result_ok);
9501         return DecodeError_clone(&*owner->contents.err);
9502 }
9503 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(uint64_t owner) {
9504         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
9505         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9506         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
9507         uint64_t ret_ref = tag_ptr(ret_copy, true);
9508         return ret_ref;
9509 }
9510
9511 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9512         LDKUpdateAddHTLC ret = *owner->contents.result;
9513         ret.is_owned = false;
9514         return ret;
9515 }
9516 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_ok(uint64_t owner) {
9517         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9518         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
9519         uint64_t ret_ref = 0;
9520         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9521         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9522         return ret_ref;
9523 }
9524
9525 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
9526 CHECK(!owner->result_ok);
9527         return DecodeError_clone(&*owner->contents.err);
9528 }
9529 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_get_err(uint64_t owner) {
9530         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
9531         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9532         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
9533         uint64_t ret_ref = tag_ptr(ret_copy, true);
9534         return ret_ref;
9535 }
9536
9537 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9538         LDKOnionMessage ret = *owner->contents.result;
9539         ret.is_owned = false;
9540         return ret;
9541 }
9542 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_ok"))) TS_CResult_OnionMessageDecodeErrorZ_get_ok(uint64_t owner) {
9543         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9544         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
9545         uint64_t ret_ref = 0;
9546         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9547         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9548         return ret_ref;
9549 }
9550
9551 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
9552 CHECK(!owner->result_ok);
9553         return DecodeError_clone(&*owner->contents.err);
9554 }
9555 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_get_err"))) TS_CResult_OnionMessageDecodeErrorZ_get_err(uint64_t owner) {
9556         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
9557         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9558         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
9559         uint64_t ret_ref = tag_ptr(ret_copy, true);
9560         return ret_ref;
9561 }
9562
9563 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9564         LDKPing ret = *owner->contents.result;
9565         ret.is_owned = false;
9566         return ret;
9567 }
9568 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_ok"))) TS_CResult_PingDecodeErrorZ_get_ok(uint64_t owner) {
9569         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9570         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
9571         uint64_t ret_ref = 0;
9572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9574         return ret_ref;
9575 }
9576
9577 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
9578 CHECK(!owner->result_ok);
9579         return DecodeError_clone(&*owner->contents.err);
9580 }
9581 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_get_err"))) TS_CResult_PingDecodeErrorZ_get_err(uint64_t owner) {
9582         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
9583         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9584         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
9585         uint64_t ret_ref = tag_ptr(ret_copy, true);
9586         return ret_ref;
9587 }
9588
9589 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9590         LDKPong ret = *owner->contents.result;
9591         ret.is_owned = false;
9592         return ret;
9593 }
9594 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_ok"))) TS_CResult_PongDecodeErrorZ_get_ok(uint64_t owner) {
9595         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9596         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
9597         uint64_t ret_ref = 0;
9598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9600         return ret_ref;
9601 }
9602
9603 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
9604 CHECK(!owner->result_ok);
9605         return DecodeError_clone(&*owner->contents.err);
9606 }
9607 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_get_err"))) TS_CResult_PongDecodeErrorZ_get_err(uint64_t owner) {
9608         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
9609         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9610         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
9611         uint64_t ret_ref = tag_ptr(ret_copy, true);
9612         return ret_ref;
9613 }
9614
9615 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9616         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
9617         ret.is_owned = false;
9618         return ret;
9619 }
9620 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9621         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9622         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9623         uint64_t ret_ref = 0;
9624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9626         return ret_ref;
9627 }
9628
9629 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9630 CHECK(!owner->result_ok);
9631         return DecodeError_clone(&*owner->contents.err);
9632 }
9633 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9634         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9635         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9636         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9637         uint64_t ret_ref = tag_ptr(ret_copy, true);
9638         return ret_ref;
9639 }
9640
9641 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9642         LDKChannelAnnouncement ret = *owner->contents.result;
9643         ret.is_owned = false;
9644         return ret;
9645 }
9646 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9647         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9648         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
9649         uint64_t ret_ref = 0;
9650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9652         return ret_ref;
9653 }
9654
9655 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9656 CHECK(!owner->result_ok);
9657         return DecodeError_clone(&*owner->contents.err);
9658 }
9659 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9660         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
9661         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9662         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
9663         uint64_t ret_ref = tag_ptr(ret_copy, true);
9664         return ret_ref;
9665 }
9666
9667 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9668         LDKUnsignedChannelUpdate ret = *owner->contents.result;
9669         ret.is_owned = false;
9670         return ret;
9671 }
9672 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9673         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9674         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9675         uint64_t ret_ref = 0;
9676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9678         return ret_ref;
9679 }
9680
9681 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9682 CHECK(!owner->result_ok);
9683         return DecodeError_clone(&*owner->contents.err);
9684 }
9685 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9686         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9687         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9688         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
9689         uint64_t ret_ref = tag_ptr(ret_copy, true);
9690         return ret_ref;
9691 }
9692
9693 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9694         LDKChannelUpdate ret = *owner->contents.result;
9695         ret.is_owned = false;
9696         return ret;
9697 }
9698 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_ok(uint64_t owner) {
9699         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9700         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
9701         uint64_t ret_ref = 0;
9702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9703         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9704         return ret_ref;
9705 }
9706
9707 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
9708 CHECK(!owner->result_ok);
9709         return DecodeError_clone(&*owner->contents.err);
9710 }
9711 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_get_err(uint64_t owner) {
9712         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
9713         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9714         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
9715         uint64_t ret_ref = tag_ptr(ret_copy, true);
9716         return ret_ref;
9717 }
9718
9719 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9720         LDKErrorMessage ret = *owner->contents.result;
9721         ret.is_owned = false;
9722         return ret;
9723 }
9724 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_get_ok(uint64_t owner) {
9725         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9726         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
9727         uint64_t ret_ref = 0;
9728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9730         return ret_ref;
9731 }
9732
9733 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
9734 CHECK(!owner->result_ok);
9735         return DecodeError_clone(&*owner->contents.err);
9736 }
9737 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_get_err"))) TS_CResult_ErrorMessageDecodeErrorZ_get_err(uint64_t owner) {
9738         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
9739         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9740         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
9741         uint64_t ret_ref = tag_ptr(ret_copy, true);
9742         return ret_ref;
9743 }
9744
9745 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9746         LDKWarningMessage ret = *owner->contents.result;
9747         ret.is_owned = false;
9748         return ret;
9749 }
9750 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_ok"))) TS_CResult_WarningMessageDecodeErrorZ_get_ok(uint64_t owner) {
9751         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9752         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
9753         uint64_t ret_ref = 0;
9754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9756         return ret_ref;
9757 }
9758
9759 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
9760 CHECK(!owner->result_ok);
9761         return DecodeError_clone(&*owner->contents.err);
9762 }
9763 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_get_err"))) TS_CResult_WarningMessageDecodeErrorZ_get_err(uint64_t owner) {
9764         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
9765         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9766         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
9767         uint64_t ret_ref = tag_ptr(ret_copy, true);
9768         return ret_ref;
9769 }
9770
9771 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9772         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
9773         ret.is_owned = false;
9774         return ret;
9775 }
9776 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9777         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9778         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9779         uint64_t ret_ref = 0;
9780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9782         return ret_ref;
9783 }
9784
9785 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9786 CHECK(!owner->result_ok);
9787         return DecodeError_clone(&*owner->contents.err);
9788 }
9789 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9790         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9791         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9792         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9793         uint64_t ret_ref = tag_ptr(ret_copy, true);
9794         return ret_ref;
9795 }
9796
9797 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9798         LDKNodeAnnouncement ret = *owner->contents.result;
9799         ret.is_owned = false;
9800         return ret;
9801 }
9802 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_ok(uint64_t owner) {
9803         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9804         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
9805         uint64_t ret_ref = 0;
9806         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9807         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9808         return ret_ref;
9809 }
9810
9811 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
9812 CHECK(!owner->result_ok);
9813         return DecodeError_clone(&*owner->contents.err);
9814 }
9815 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_get_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_get_err(uint64_t owner) {
9816         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
9817         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9818         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
9819         uint64_t ret_ref = tag_ptr(ret_copy, true);
9820         return ret_ref;
9821 }
9822
9823 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9824         LDKQueryShortChannelIds ret = *owner->contents.result;
9825         ret.is_owned = false;
9826         return ret;
9827 }
9828 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(uint64_t owner) {
9829         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9830         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
9831         uint64_t ret_ref = 0;
9832         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9833         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9834         return ret_ref;
9835 }
9836
9837 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
9838 CHECK(!owner->result_ok);
9839         return DecodeError_clone(&*owner->contents.err);
9840 }
9841 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_get_err(uint64_t owner) {
9842         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
9843         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9844         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
9845         uint64_t ret_ref = tag_ptr(ret_copy, true);
9846         return ret_ref;
9847 }
9848
9849 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9850         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
9851         ret.is_owned = false;
9852         return ret;
9853 }
9854 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(uint64_t owner) {
9855         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9856         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
9857         uint64_t ret_ref = 0;
9858         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9859         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9860         return ret_ref;
9861 }
9862
9863 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
9864 CHECK(!owner->result_ok);
9865         return DecodeError_clone(&*owner->contents.err);
9866 }
9867 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(uint64_t owner) {
9868         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
9869         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9870         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
9871         uint64_t ret_ref = tag_ptr(ret_copy, true);
9872         return ret_ref;
9873 }
9874
9875 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9876         LDKQueryChannelRange ret = *owner->contents.result;
9877         ret.is_owned = false;
9878         return ret;
9879 }
9880 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
9881         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9882         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
9883         uint64_t ret_ref = 0;
9884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9886         return ret_ref;
9887 }
9888
9889 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9890 CHECK(!owner->result_ok);
9891         return DecodeError_clone(&*owner->contents.err);
9892 }
9893 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_get_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
9894         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
9895         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9896         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
9897         uint64_t ret_ref = tag_ptr(ret_copy, true);
9898         return ret_ref;
9899 }
9900
9901 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9902         LDKReplyChannelRange ret = *owner->contents.result;
9903         ret.is_owned = false;
9904         return ret;
9905 }
9906 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_ok(uint64_t owner) {
9907         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9908         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
9909         uint64_t ret_ref = 0;
9910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9912         return ret_ref;
9913 }
9914
9915 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
9916 CHECK(!owner->result_ok);
9917         return DecodeError_clone(&*owner->contents.err);
9918 }
9919 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_get_err(uint64_t owner) {
9920         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
9921         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9922         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
9923         uint64_t ret_ref = tag_ptr(ret_copy, true);
9924         return ret_ref;
9925 }
9926
9927 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9928         LDKGossipTimestampFilter ret = *owner->contents.result;
9929         ret.is_owned = false;
9930         return ret;
9931 }
9932 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_ok(uint64_t owner) {
9933         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9934         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
9935         uint64_t ret_ref = 0;
9936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
9938         return ret_ref;
9939 }
9940
9941 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
9942 CHECK(!owner->result_ok);
9943         return DecodeError_clone(&*owner->contents.err);
9944 }
9945 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_get_err(uint64_t owner) {
9946         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
9947         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
9948         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
9949         uint64_t ret_ref = tag_ptr(ret_copy, true);
9950         return ret_ref;
9951 }
9952
9953 uint32_t __attribute__((export_name("TS_LDKCOption_KeyPairZ_ty_from_ptr"))) TS_LDKCOption_KeyPairZ_ty_from_ptr(uint64_t ptr) {
9954         LDKCOption_KeyPairZ *obj = (LDKCOption_KeyPairZ*)untag_ptr(ptr);
9955         switch(obj->tag) {
9956                 case LDKCOption_KeyPairZ_Some: return 0;
9957                 case LDKCOption_KeyPairZ_None: return 1;
9958                 default: abort();
9959         }
9960 }
9961 int8_tArray __attribute__((export_name("TS_LDKCOption_KeyPairZ_Some_get_some"))) TS_LDKCOption_KeyPairZ_Some_get_some(uint64_t ptr) {
9962         LDKCOption_KeyPairZ *obj = (LDKCOption_KeyPairZ*)untag_ptr(ptr);
9963         assert(obj->tag == LDKCOption_KeyPairZ_Some);
9964                         int8_tArray some_arr = init_int8_tArray(32, __LINE__);
9965                         memcpy(some_arr->elems, obj->some.bytes, 32);
9966         return some_arr;
9967 }
9968 static inline struct LDKCOption_KeyPairZ CResult_COption_KeyPairZNoneZ_get_ok(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR owner){
9969 CHECK(owner->result_ok);
9970         return COption_KeyPairZ_clone(&*owner->contents.result);
9971 }
9972 uint64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_get_ok"))) TS_CResult_COption_KeyPairZNoneZ_get_ok(uint64_t owner) {
9973         LDKCResult_COption_KeyPairZNoneZ* owner_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(owner);
9974         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
9975         *ret_copy = CResult_COption_KeyPairZNoneZ_get_ok(owner_conv);
9976         uint64_t ret_ref = tag_ptr(ret_copy, true);
9977         return ret_ref;
9978 }
9979
9980 static inline void CResult_COption_KeyPairZNoneZ_get_err(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR owner){
9981 CHECK(!owner->result_ok);
9982         return *owner->contents.err;
9983 }
9984 void  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_get_err"))) TS_CResult_COption_KeyPairZNoneZ_get_err(uint64_t owner) {
9985         LDKCResult_COption_KeyPairZNoneZ* owner_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(owner);
9986         CResult_COption_KeyPairZNoneZ_get_err(owner_conv);
9987 }
9988
9989 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
9990         LDKInvoiceError ret = *owner->contents.result;
9991         ret.is_owned = false;
9992         return ret;
9993 }
9994 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_ok(uint64_t owner) {
9995         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
9996         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
9997         uint64_t ret_ref = 0;
9998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
9999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10000         return ret_ref;
10001 }
10002
10003 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
10004 CHECK(!owner->result_ok);
10005         return DecodeError_clone(&*owner->contents.err);
10006 }
10007 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_get_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_get_err(uint64_t owner) {
10008         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
10009         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10010         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
10011         uint64_t ret_ref = tag_ptr(ret_copy, true);
10012         return ret_ref;
10013 }
10014
10015 typedef struct LDKFilter_JCalls {
10016         atomic_size_t refcnt;
10017         uint32_t instance_ptr;
10018 } LDKFilter_JCalls;
10019 static void LDKFilter_JCalls_free(void* this_arg) {
10020         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10021         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10022                 FREE(j_calls);
10023         }
10024 }
10025 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
10026         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10027         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
10028         memcpy(txid_arr->elems, *txid, 32);
10029         LDKu8slice script_pubkey_var = script_pubkey;
10030         int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__);
10031         memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen);
10032         js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0);
10033 }
10034 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
10035         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
10036         LDKWatchedOutput output_var = output;
10037         uint64_t output_ref = 0;
10038         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
10039         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
10040         js_invoke_function_buuuuu(j_calls->instance_ptr, 42, output_ref, 0, 0, 0, 0, 0);
10041 }
10042 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
10043         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
10044         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10045 }
10046 static inline LDKFilter LDKFilter_init (JSValue o) {
10047         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
10048         atomic_init(&calls->refcnt, 1);
10049         calls->instance_ptr = o;
10050
10051         LDKFilter ret = {
10052                 .this_arg = (void*) calls,
10053                 .register_tx = register_tx_LDKFilter_jcall,
10054                 .register_output = register_output_LDKFilter_jcall,
10055                 .free = LDKFilter_JCalls_free,
10056         };
10057         return ret;
10058 }
10059 uint64_t  __attribute__((export_name("TS_LDKFilter_new"))) TS_LDKFilter_new(JSValue o) {
10060         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
10061         *res_ptr = LDKFilter_init(o);
10062         return tag_ptr(res_ptr, true);
10063 }
10064 void  __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_tx(uint64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
10065         void* this_arg_ptr = untag_ptr(this_arg);
10066         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10067         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10068         uint8_t txid_arr[32];
10069         CHECK(txid->arr_len == 32);
10070         memcpy(txid_arr, txid->elems, 32); FREE(txid);
10071         uint8_t (*txid_ref)[32] = &txid_arr;
10072         LDKu8slice script_pubkey_ref;
10073         script_pubkey_ref.datalen = script_pubkey->arr_len;
10074         script_pubkey_ref.data = script_pubkey->elems;
10075         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
10076         FREE(script_pubkey);
10077 }
10078
10079 void  __attribute__((export_name("TS_Filter_register_output"))) TS_Filter_register_output(uint64_t this_arg, uint64_t output) {
10080         void* this_arg_ptr = untag_ptr(this_arg);
10081         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10082         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
10083         LDKWatchedOutput output_conv;
10084         output_conv.inner = untag_ptr(output);
10085         output_conv.is_owned = ptr_is_owned(output);
10086         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
10087         output_conv = WatchedOutput_clone(&output_conv);
10088         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
10089 }
10090
10091 uint32_t __attribute__((export_name("TS_LDKCOption_FilterZ_ty_from_ptr"))) TS_LDKCOption_FilterZ_ty_from_ptr(uint64_t ptr) {
10092         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
10093         switch(obj->tag) {
10094                 case LDKCOption_FilterZ_Some: return 0;
10095                 case LDKCOption_FilterZ_None: return 1;
10096                 default: abort();
10097         }
10098 }
10099 uint64_t __attribute__((export_name("TS_LDKCOption_FilterZ_Some_get_some"))) TS_LDKCOption_FilterZ_Some_get_some(uint64_t ptr) {
10100         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
10101         assert(obj->tag == LDKCOption_FilterZ_Some);
10102                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
10103                         *some_ret = obj->some;
10104                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
10105                         if ((*some_ret).free == LDKFilter_JCalls_free) {
10106                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10107                                 LDKFilter_JCalls_cloned(&(*some_ret));
10108                         }
10109         return tag_ptr(some_ret, true);
10110 }
10111 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10112         LDKLockedChannelMonitor ret = *owner->contents.result;
10113         ret.is_owned = false;
10114         return ret;
10115 }
10116 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_ok"))) TS_CResult_LockedChannelMonitorNoneZ_get_ok(uint64_t owner) {
10117         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
10118         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
10119         uint64_t ret_ref = 0;
10120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10122         return ret_ref;
10123 }
10124
10125 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
10126 CHECK(!owner->result_ok);
10127         return *owner->contents.err;
10128 }
10129 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_get_err"))) TS_CResult_LockedChannelMonitorNoneZ_get_err(uint64_t owner) {
10130         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
10131         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
10132 }
10133
10134 static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) {
10135         LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen };
10136         for (size_t i = 0; i < ret.datalen; i++) {
10137                 ret.data[i] = OutPoint_clone(&orig->data[i]);
10138         }
10139         return ret;
10140 }
10141 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
10142         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
10143         for (size_t i = 0; i < ret.datalen; i++) {
10144                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
10145         }
10146         return ret;
10147 }
10148 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
10149         LDKOutPoint ret = owner->a;
10150         ret.is_owned = false;
10151         return ret;
10152 }
10153 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) {
10154         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
10155         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
10156         uint64_t ret_ref = 0;
10157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10159         return ret_ref;
10160 }
10161
10162 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
10163         return CVec_MonitorUpdateIdZ_clone(&owner->b);
10164 }
10165 uint64_tArray  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) {
10166         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
10167         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
10168         uint64_tArray ret_arr = NULL;
10169         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
10170         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
10171         for (size_t r = 0; r < ret_var.datalen; r++) {
10172                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
10173                 uint64_t ret_conv_17_ref = 0;
10174                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
10175                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
10176                 ret_arr_ptr[r] = ret_conv_17_ref;
10177         }
10178         
10179         FREE(ret_var.data);
10180         return ret_arr;
10181 }
10182
10183 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
10184         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
10185         for (size_t i = 0; i < ret.datalen; i++) {
10186                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
10187         }
10188         return ret;
10189 }
10190 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
10191         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
10192         for (size_t i = 0; i < ret.datalen; i++) {
10193                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
10194         }
10195         return ret;
10196 }
10197 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) {
10198         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10199         switch(obj->tag) {
10200                 case LDKSignOrCreationError_SignError: return 0;
10201                 case LDKSignOrCreationError_CreationError: return 1;
10202                 default: abort();
10203         }
10204 }
10205 uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_CreationError_get_creation_error"))) TS_LDKSignOrCreationError_CreationError_get_creation_error(uint64_t ptr) {
10206         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
10207         assert(obj->tag == LDKSignOrCreationError_CreationError);
10208                         uint32_t creation_error_conv = LDKCreationError_to_js(obj->creation_error);
10209         return creation_error_conv;
10210 }
10211 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10212         LDKBolt11Invoice ret = *owner->contents.result;
10213         ret.is_owned = false;
10214         return ret;
10215 }
10216 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(uint64_t owner) {
10217         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10218         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
10219         uint64_t ret_ref = 0;
10220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10222         return ret_ref;
10223 }
10224
10225 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
10226 CHECK(!owner->result_ok);
10227         return SignOrCreationError_clone(&*owner->contents.err);
10228 }
10229 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(uint64_t owner) {
10230         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
10231         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
10232         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
10233         uint64_t ret_ref = tag_ptr(ret_copy, true);
10234         return ret_ref;
10235 }
10236
10237 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_ty_from_ptr"))) TS_LDKBolt11ParseError_ty_from_ptr(uint64_t ptr) {
10238         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10239         switch(obj->tag) {
10240                 case LDKBolt11ParseError_Bech32Error: return 0;
10241                 case LDKBolt11ParseError_ParseAmountError: return 1;
10242                 case LDKBolt11ParseError_MalformedSignature: return 2;
10243                 case LDKBolt11ParseError_BadPrefix: return 3;
10244                 case LDKBolt11ParseError_UnknownCurrency: return 4;
10245                 case LDKBolt11ParseError_UnknownSiPrefix: return 5;
10246                 case LDKBolt11ParseError_MalformedHRP: return 6;
10247                 case LDKBolt11ParseError_TooShortDataPart: return 7;
10248                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: return 8;
10249                 case LDKBolt11ParseError_DescriptionDecodeError: return 9;
10250                 case LDKBolt11ParseError_PaddingError: return 10;
10251                 case LDKBolt11ParseError_IntegerOverflowError: return 11;
10252                 case LDKBolt11ParseError_InvalidSegWitProgramLength: return 12;
10253                 case LDKBolt11ParseError_InvalidPubKeyHashLength: return 13;
10254                 case LDKBolt11ParseError_InvalidScriptHashLength: return 14;
10255                 case LDKBolt11ParseError_InvalidRecoveryId: return 15;
10256                 case LDKBolt11ParseError_InvalidSliceLength: return 16;
10257                 case LDKBolt11ParseError_Skip: return 17;
10258                 default: abort();
10259         }
10260 }
10261 uint64_t __attribute__((export_name("TS_LDKBolt11ParseError_Bech32Error_get_bech32_error"))) TS_LDKBolt11ParseError_Bech32Error_get_bech32_error(uint64_t ptr) {
10262         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10263         assert(obj->tag == LDKBolt11ParseError_Bech32Error);
10264                         uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
10265         return bech32_error_ref;
10266 }
10267 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKBolt11ParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) {
10268         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10269         assert(obj->tag == LDKBolt11ParseError_ParseAmountError);
10270                         /*obj->parse_amount_error*/
10271         return 0;
10272 }
10273 uint32_t __attribute__((export_name("TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature"))) TS_LDKBolt11ParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) {
10274         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10275         assert(obj->tag == LDKBolt11ParseError_MalformedSignature);
10276                         uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature);
10277         return malformed_signature_conv;
10278 }
10279 int32_t __attribute__((export_name("TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKBolt11ParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) {
10280         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10281         assert(obj->tag == LDKBolt11ParseError_DescriptionDecodeError);
10282                         /*obj->description_decode_error*/
10283         return 0;
10284 }
10285 jstring __attribute__((export_name("TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKBolt11ParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) {
10286         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
10287         assert(obj->tag == LDKBolt11ParseError_InvalidSliceLength);
10288                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
10289                         jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len);
10290         return invalid_slice_length_conv;
10291 }
10292 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10293 CHECK(owner->result_ok);
10294         return SiPrefix_clone(&*owner->contents.result);
10295 }
10296 uint32_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_ok(uint64_t owner) {
10297         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10298         uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
10299         return ret_conv;
10300 }
10301
10302 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
10303 CHECK(!owner->result_ok);
10304         return Bolt11ParseError_clone(&*owner->contents.err);
10305 }
10306 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_get_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_get_err(uint64_t owner) {
10307         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
10308         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10309         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
10310         uint64_t ret_ref = tag_ptr(ret_copy, true);
10311         return ret_ref;
10312 }
10313
10314 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) {
10315         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10316         switch(obj->tag) {
10317                 case LDKParseOrSemanticError_ParseError: return 0;
10318                 case LDKParseOrSemanticError_SemanticError: return 1;
10319                 default: abort();
10320         }
10321 }
10322 uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) {
10323         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10324         assert(obj->tag == LDKParseOrSemanticError_ParseError);
10325                         uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
10326         return parse_error_ref;
10327 }
10328 uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) {
10329         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
10330         assert(obj->tag == LDKParseOrSemanticError_SemanticError);
10331                         uint32_t semantic_error_conv = LDKBolt11SemanticError_to_js(obj->semantic_error);
10332         return semantic_error_conv;
10333 }
10334 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10335         LDKBolt11Invoice ret = *owner->contents.result;
10336         ret.is_owned = false;
10337         return ret;
10338 }
10339 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) {
10340         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10341         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
10342         uint64_t ret_ref = 0;
10343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10345         return ret_ref;
10346 }
10347
10348 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
10349 CHECK(!owner->result_ok);
10350         return ParseOrSemanticError_clone(&*owner->contents.err);
10351 }
10352 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) {
10353         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
10354         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
10355         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
10356         uint64_t ret_ref = tag_ptr(ret_copy, true);
10357         return ret_ref;
10358 }
10359
10360 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10361         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
10362         ret.is_owned = false;
10363         return ret;
10364 }
10365 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(uint64_t owner) {
10366         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10367         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
10368         uint64_t ret_ref = 0;
10369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10371         return ret_ref;
10372 }
10373
10374 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
10375 CHECK(!owner->result_ok);
10376         return Bolt11ParseError_clone(&*owner->contents.err);
10377 }
10378 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(uint64_t owner) {
10379         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
10380         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
10381         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
10382         uint64_t ret_ref = tag_ptr(ret_copy, true);
10383         return ret_ref;
10384 }
10385
10386 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10387         LDKRawBolt11Invoice ret = owner->a;
10388         ret.is_owned = false;
10389         return ret;
10390 }
10391 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(uint64_t owner) {
10392         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10393         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
10394         uint64_t ret_ref = 0;
10395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10397         return ret_ref;
10398 }
10399
10400 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10401         return ThirtyTwoBytes_clone(&owner->b);
10402 }
10403 int8_tArray  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(uint64_t owner) {
10404         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10405         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
10406         memcpy(ret_arr->elems, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data, 32);
10407         return ret_arr;
10408 }
10409
10410 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
10411         LDKBolt11InvoiceSignature ret = owner->c;
10412         ret.is_owned = false;
10413         return ret;
10414 }
10415 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(uint64_t owner) {
10416         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
10417         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
10418         uint64_t ret_ref = 0;
10419         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10420         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10421         return ret_ref;
10422 }
10423
10424 static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
10425         LDKPayeePubKey ret = *owner->contents.result;
10426         ret.is_owned = false;
10427         return ret;
10428 }
10429 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) {
10430         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
10431         LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv);
10432         uint64_t ret_ref = 0;
10433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10435         return ret_ref;
10436 }
10437
10438 static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){
10439 CHECK(!owner->result_ok);
10440         return *owner->contents.err;
10441 }
10442 uint32_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) {
10443         LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner);
10444         uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv));
10445         return ret_conv;
10446 }
10447
10448 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
10449         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
10450         for (size_t i = 0; i < ret.datalen; i++) {
10451                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
10452         }
10453         return ret;
10454 }
10455 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10456         LDKPositiveTimestamp ret = *owner->contents.result;
10457         ret.is_owned = false;
10458         return ret;
10459 }
10460 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) {
10461         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10462         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_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 enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
10470 CHECK(!owner->result_ok);
10471         return CreationError_clone(&*owner->contents.err);
10472 }
10473 uint32_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) {
10474         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
10475         uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
10476         return ret_conv;
10477 }
10478
10479 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10480 CHECK(owner->result_ok);
10481         return *owner->contents.result;
10482 }
10483 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10484         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10485         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
10486 }
10487
10488 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
10489 CHECK(!owner->result_ok);
10490         return Bolt11SemanticError_clone(&*owner->contents.err);
10491 }
10492 uint32_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_get_err"))) TS_CResult_NoneBolt11SemanticErrorZ_get_err(uint64_t owner) {
10493         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
10494         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
10495         return ret_conv;
10496 }
10497
10498 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10499         LDKBolt11Invoice ret = *owner->contents.result;
10500         ret.is_owned = false;
10501         return ret;
10502 }
10503 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(uint64_t owner) {
10504         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10505         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
10506         uint64_t ret_ref = 0;
10507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10509         return ret_ref;
10510 }
10511
10512 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
10513 CHECK(!owner->result_ok);
10514         return Bolt11SemanticError_clone(&*owner->contents.err);
10515 }
10516 uint32_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(uint64_t owner) {
10517         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
10518         uint32_t ret_conv = LDKBolt11SemanticError_to_js(CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
10519         return ret_conv;
10520 }
10521
10522 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10523         LDKDescription ret = *owner->contents.result;
10524         ret.is_owned = false;
10525         return ret;
10526 }
10527 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) {
10528         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10529         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
10530         uint64_t ret_ref = 0;
10531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10533         return ret_ref;
10534 }
10535
10536 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
10537 CHECK(!owner->result_ok);
10538         return CreationError_clone(&*owner->contents.err);
10539 }
10540 uint32_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) {
10541         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
10542         uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv));
10543         return ret_conv;
10544 }
10545
10546 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10547         LDKPrivateRoute ret = *owner->contents.result;
10548         ret.is_owned = false;
10549         return ret;
10550 }
10551 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) {
10552         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10553         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
10554         uint64_t ret_ref = 0;
10555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10557         return ret_ref;
10558 }
10559
10560 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
10561 CHECK(!owner->result_ok);
10562         return CreationError_clone(&*owner->contents.err);
10563 }
10564 uint32_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) {
10565         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
10566         uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
10567         return ret_conv;
10568 }
10569
10570 typedef struct LDKScore_JCalls {
10571         atomic_size_t refcnt;
10572         uint32_t instance_ptr;
10573 } LDKScore_JCalls;
10574 static void LDKScore_JCalls_free(void* this_arg) {
10575         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10576         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10577                 FREE(j_calls);
10578         }
10579 }
10580 uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
10581         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10582         int64_t short_channel_id_conv = short_channel_id;
10583         LDKNodeId source_var = *source;
10584         uint64_t source_ref = 0;
10585         source_var = NodeId_clone(&source_var);
10586         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_var);
10587         source_ref = tag_ptr(source_var.inner, source_var.is_owned);
10588         LDKNodeId target_var = *target;
10589         uint64_t target_ref = 0;
10590         target_var = NodeId_clone(&target_var);
10591         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_var);
10592         target_ref = tag_ptr(target_var.inner, target_var.is_owned);
10593         LDKChannelUsage usage_var = usage;
10594         uint64_t usage_ref = 0;
10595         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
10596         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
10597         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
10598         uint64_t score_params_ref = 0;
10599         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
10600         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
10601         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
10602         return js_invoke_function_bbbbbu(j_calls->instance_ptr, 43, short_channel_id_conv, source_ref, target_ref, usage_ref, score_params_ref, 0);
10603 }
10604 void payment_path_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
10605         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10606         LDKPath path_var = *path;
10607         uint64_t path_ref = 0;
10608         path_var = Path_clone(&path_var);
10609         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10610         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
10611         int64_t short_channel_id_conv = short_channel_id;
10612         js_invoke_function_bbuuuu(j_calls->instance_ptr, 44, path_ref, short_channel_id_conv, 0, 0, 0, 0);
10613 }
10614 void payment_path_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
10615         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10616         LDKPath path_var = *path;
10617         uint64_t path_ref = 0;
10618         path_var = Path_clone(&path_var);
10619         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10620         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
10621         js_invoke_function_buuuuu(j_calls->instance_ptr, 45, path_ref, 0, 0, 0, 0, 0);
10622 }
10623 void probe_failed_LDKScore_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id) {
10624         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10625         LDKPath path_var = *path;
10626         uint64_t path_ref = 0;
10627         path_var = Path_clone(&path_var);
10628         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10629         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
10630         int64_t short_channel_id_conv = short_channel_id;
10631         js_invoke_function_bbuuuu(j_calls->instance_ptr, 46, path_ref, short_channel_id_conv, 0, 0, 0, 0);
10632 }
10633 void probe_successful_LDKScore_jcall(void* this_arg, const LDKPath * path) {
10634         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10635         LDKPath path_var = *path;
10636         uint64_t path_ref = 0;
10637         path_var = Path_clone(&path_var);
10638         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
10639         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
10640         js_invoke_function_buuuuu(j_calls->instance_ptr, 47, path_ref, 0, 0, 0, 0, 0);
10641 }
10642 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
10643         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
10644         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, 0, 0, 0, 0, 0, 0);
10645         LDKCVec_u8Z ret_ref;
10646         ret_ref.datalen = ret->arr_len;
10647         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10648         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
10649         return ret_ref;
10650 }
10651 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
10652         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
10653         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10654 }
10655 static inline LDKScore LDKScore_init (JSValue o) {
10656         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
10657         atomic_init(&calls->refcnt, 1);
10658         calls->instance_ptr = o;
10659
10660         LDKScore ret = {
10661                 .this_arg = (void*) calls,
10662                 .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall,
10663                 .payment_path_failed = payment_path_failed_LDKScore_jcall,
10664                 .payment_path_successful = payment_path_successful_LDKScore_jcall,
10665                 .probe_failed = probe_failed_LDKScore_jcall,
10666                 .probe_successful = probe_successful_LDKScore_jcall,
10667                 .write = write_LDKScore_jcall,
10668                 .free = LDKScore_JCalls_free,
10669         };
10670         return ret;
10671 }
10672 uint64_t  __attribute__((export_name("TS_LDKScore_new"))) TS_LDKScore_new(JSValue o) {
10673         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
10674         *res_ptr = LDKScore_init(o);
10675         return tag_ptr(res_ptr, true);
10676 }
10677 int64_t  __attribute__((export_name("TS_Score_channel_penalty_msat"))) TS_Score_channel_penalty_msat(uint64_t this_arg, int64_t short_channel_id, uint64_t source, uint64_t target, uint64_t usage, uint64_t score_params) {
10678         void* this_arg_ptr = untag_ptr(this_arg);
10679         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10680         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10681         LDKNodeId source_conv;
10682         source_conv.inner = untag_ptr(source);
10683         source_conv.is_owned = ptr_is_owned(source);
10684         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
10685         source_conv.is_owned = false;
10686         LDKNodeId target_conv;
10687         target_conv.inner = untag_ptr(target);
10688         target_conv.is_owned = ptr_is_owned(target);
10689         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
10690         target_conv.is_owned = false;
10691         LDKChannelUsage usage_conv;
10692         usage_conv.inner = untag_ptr(usage);
10693         usage_conv.is_owned = ptr_is_owned(usage);
10694         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
10695         usage_conv = ChannelUsage_clone(&usage_conv);
10696         LDKProbabilisticScoringFeeParameters score_params_conv;
10697         score_params_conv.inner = untag_ptr(score_params);
10698         score_params_conv.is_owned = ptr_is_owned(score_params);
10699         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
10700         score_params_conv.is_owned = false;
10701         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);
10702         return ret_conv;
10703 }
10704
10705 void  __attribute__((export_name("TS_Score_payment_path_failed"))) TS_Score_payment_path_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
10706         void* this_arg_ptr = untag_ptr(this_arg);
10707         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10708         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10709         LDKPath path_conv;
10710         path_conv.inner = untag_ptr(path);
10711         path_conv.is_owned = ptr_is_owned(path);
10712         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
10713         path_conv.is_owned = false;
10714         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
10715 }
10716
10717 void  __attribute__((export_name("TS_Score_payment_path_successful"))) TS_Score_payment_path_successful(uint64_t this_arg, uint64_t path) {
10718         void* this_arg_ptr = untag_ptr(this_arg);
10719         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10720         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10721         LDKPath path_conv;
10722         path_conv.inner = untag_ptr(path);
10723         path_conv.is_owned = ptr_is_owned(path);
10724         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
10725         path_conv.is_owned = false;
10726         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv);
10727 }
10728
10729 void  __attribute__((export_name("TS_Score_probe_failed"))) TS_Score_probe_failed(uint64_t this_arg, uint64_t path, int64_t short_channel_id) {
10730         void* this_arg_ptr = untag_ptr(this_arg);
10731         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10732         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10733         LDKPath path_conv;
10734         path_conv.inner = untag_ptr(path);
10735         path_conv.is_owned = ptr_is_owned(path);
10736         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
10737         path_conv.is_owned = false;
10738         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id);
10739 }
10740
10741 void  __attribute__((export_name("TS_Score_probe_successful"))) TS_Score_probe_successful(uint64_t this_arg, uint64_t path) {
10742         void* this_arg_ptr = untag_ptr(this_arg);
10743         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10744         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10745         LDKPath path_conv;
10746         path_conv.inner = untag_ptr(path);
10747         path_conv.is_owned = ptr_is_owned(path);
10748         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
10749         path_conv.is_owned = false;
10750         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv);
10751 }
10752
10753 int8_tArray  __attribute__((export_name("TS_Score_write"))) TS_Score_write(uint64_t this_arg) {
10754         void* this_arg_ptr = untag_ptr(this_arg);
10755         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10756         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
10757         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10758         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
10759         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
10760         CVec_u8Z_free(ret_var);
10761         return ret_arr;
10762 }
10763
10764 typedef struct LDKLockableScore_JCalls {
10765         atomic_size_t refcnt;
10766         uint32_t instance_ptr;
10767 } LDKLockableScore_JCalls;
10768 static void LDKLockableScore_JCalls_free(void* this_arg) {
10769         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10770         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10771                 FREE(j_calls);
10772         }
10773 }
10774 LDKScore lock_LDKLockableScore_jcall(const void* this_arg) {
10775         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
10776         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0);
10777         void* ret_ptr = untag_ptr(ret);
10778         CHECK_ACCESS(ret_ptr);
10779         LDKScore ret_conv = *(LDKScore*)(ret_ptr);
10780         if (ret_conv.free == LDKScore_JCalls_free) {
10781                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10782                 LDKScore_JCalls_cloned(&ret_conv);
10783         }// WARNING: we may need a move here but no clone is available for LDKScore
10784         
10785         return ret_conv;
10786 }
10787 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
10788         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
10789         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10790 }
10791 static inline LDKLockableScore LDKLockableScore_init (JSValue o) {
10792         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
10793         atomic_init(&calls->refcnt, 1);
10794         calls->instance_ptr = o;
10795
10796         LDKLockableScore ret = {
10797                 .this_arg = (void*) calls,
10798                 .lock = lock_LDKLockableScore_jcall,
10799                 .free = LDKLockableScore_JCalls_free,
10800         };
10801         return ret;
10802 }
10803 uint64_t  __attribute__((export_name("TS_LDKLockableScore_new"))) TS_LDKLockableScore_new(JSValue o) {
10804         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
10805         *res_ptr = LDKLockableScore_init(o);
10806         return tag_ptr(res_ptr, true);
10807 }
10808 uint64_t  __attribute__((export_name("TS_LockableScore_lock"))) TS_LockableScore_lock(uint64_t this_arg) {
10809         void* this_arg_ptr = untag_ptr(this_arg);
10810         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10811         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
10812         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
10813         *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg);
10814         return tag_ptr(ret_ret, true);
10815 }
10816
10817 typedef struct LDKWriteableScore_JCalls {
10818         atomic_size_t refcnt;
10819         uint32_t instance_ptr;
10820         LDKLockableScore_JCalls* LockableScore;
10821 } LDKWriteableScore_JCalls;
10822 static void LDKWriteableScore_JCalls_free(void* this_arg) {
10823         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
10824         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10825                 FREE(j_calls);
10826         }
10827 }
10828 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
10829         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
10830         int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0);
10831         LDKCVec_u8Z ret_ref;
10832         ret_ref.datalen = ret->arr_len;
10833         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
10834         memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret);
10835         return ret_ref;
10836 }
10837 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
10838         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
10839         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10840         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
10841 }
10842 static inline LDKWriteableScore LDKWriteableScore_init (JSValue o, JSValue LockableScore) {
10843         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
10844         atomic_init(&calls->refcnt, 1);
10845         calls->instance_ptr = o;
10846
10847         LDKWriteableScore ret = {
10848                 .this_arg = (void*) calls,
10849                 .write = write_LDKWriteableScore_jcall,
10850                 .free = LDKWriteableScore_JCalls_free,
10851                 .LockableScore = LDKLockableScore_init(LockableScore),
10852         };
10853         calls->LockableScore = ret.LockableScore.this_arg;
10854         return ret;
10855 }
10856 uint64_t  __attribute__((export_name("TS_LDKWriteableScore_new"))) TS_LDKWriteableScore_new(JSValue o, JSValue LockableScore) {
10857         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
10858         *res_ptr = LDKWriteableScore_init(o, LockableScore);
10859         return tag_ptr(res_ptr, true);
10860 }
10861 int8_tArray  __attribute__((export_name("TS_WriteableScore_write"))) TS_WriteableScore_write(uint64_t this_arg) {
10862         void* this_arg_ptr = untag_ptr(this_arg);
10863         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10864         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
10865         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
10866         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
10867         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
10868         CVec_u8Z_free(ret_var);
10869         return ret_arr;
10870 }
10871
10872 typedef struct LDKPersister_JCalls {
10873         atomic_size_t refcnt;
10874         uint32_t instance_ptr;
10875 } LDKPersister_JCalls;
10876 static void LDKPersister_JCalls_free(void* this_arg) {
10877         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10878         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10879                 FREE(j_calls);
10880         }
10881 }
10882 LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
10883         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10884         LDKChannelManager channel_manager_var = *channel_manager;
10885         uint64_t channel_manager_ref = 0;
10886         // WARNING: we may need a move here but no clone is available for LDKChannelManager
10887         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
10888         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
10889         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 51, channel_manager_ref, 0, 0, 0, 0, 0);
10890         void* ret_ptr = untag_ptr(ret);
10891         CHECK_ACCESS(ret_ptr);
10892         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10893         FREE(untag_ptr(ret));
10894         return ret_conv;
10895 }
10896 LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
10897         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10898         LDKNetworkGraph network_graph_var = *network_graph;
10899         uint64_t network_graph_ref = 0;
10900         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
10901         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
10902         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
10903         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, network_graph_ref, 0, 0, 0, 0, 0);
10904         void* ret_ptr = untag_ptr(ret);
10905         CHECK_ACCESS(ret_ptr);
10906         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10907         FREE(untag_ptr(ret));
10908         return ret_conv;
10909 }
10910 LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
10911         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
10912         // WARNING: This object doesn't live past this scope, needs clone!
10913         uint64_t ret_scorer = tag_ptr(scorer, false);
10914         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 53, ret_scorer, 0, 0, 0, 0, 0);
10915         void* ret_ptr = untag_ptr(ret);
10916         CHECK_ACCESS(ret_ptr);
10917         LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr);
10918         FREE(untag_ptr(ret));
10919         return ret_conv;
10920 }
10921 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
10922         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
10923         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10924 }
10925 static inline LDKPersister LDKPersister_init (JSValue o) {
10926         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
10927         atomic_init(&calls->refcnt, 1);
10928         calls->instance_ptr = o;
10929
10930         LDKPersister ret = {
10931                 .this_arg = (void*) calls,
10932                 .persist_manager = persist_manager_LDKPersister_jcall,
10933                 .persist_graph = persist_graph_LDKPersister_jcall,
10934                 .persist_scorer = persist_scorer_LDKPersister_jcall,
10935                 .free = LDKPersister_JCalls_free,
10936         };
10937         return ret;
10938 }
10939 uint64_t  __attribute__((export_name("TS_LDKPersister_new"))) TS_LDKPersister_new(JSValue o) {
10940         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
10941         *res_ptr = LDKPersister_init(o);
10942         return tag_ptr(res_ptr, true);
10943 }
10944 uint64_t  __attribute__((export_name("TS_Persister_persist_manager"))) TS_Persister_persist_manager(uint64_t this_arg, uint64_t channel_manager) {
10945         void* this_arg_ptr = untag_ptr(this_arg);
10946         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10947         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10948         LDKChannelManager channel_manager_conv;
10949         channel_manager_conv.inner = untag_ptr(channel_manager);
10950         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
10951         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
10952         channel_manager_conv.is_owned = false;
10953         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10954         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
10955         return tag_ptr(ret_conv, true);
10956 }
10957
10958 uint64_t  __attribute__((export_name("TS_Persister_persist_graph"))) TS_Persister_persist_graph(uint64_t this_arg, uint64_t network_graph) {
10959         void* this_arg_ptr = untag_ptr(this_arg);
10960         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10961         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10962         LDKNetworkGraph network_graph_conv;
10963         network_graph_conv.inner = untag_ptr(network_graph);
10964         network_graph_conv.is_owned = ptr_is_owned(network_graph);
10965         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
10966         network_graph_conv.is_owned = false;
10967         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10968         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
10969         return tag_ptr(ret_conv, true);
10970 }
10971
10972 uint64_t  __attribute__((export_name("TS_Persister_persist_scorer"))) TS_Persister_persist_scorer(uint64_t this_arg, uint64_t scorer) {
10973         void* this_arg_ptr = untag_ptr(this_arg);
10974         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10975         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
10976         void* scorer_ptr = untag_ptr(scorer);
10977         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
10978         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
10979         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
10980         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
10981         return tag_ptr(ret_conv, true);
10982 }
10983
10984 typedef struct LDKFutureCallback_JCalls {
10985         atomic_size_t refcnt;
10986         uint32_t instance_ptr;
10987 } LDKFutureCallback_JCalls;
10988 static void LDKFutureCallback_JCalls_free(void* this_arg) {
10989         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
10990         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10991                 FREE(j_calls);
10992         }
10993 }
10994 void call_LDKFutureCallback_jcall(const void* this_arg) {
10995         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
10996         js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, 0, 0, 0, 0, 0, 0);
10997 }
10998 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
10999         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
11000         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11001 }
11002 static inline LDKFutureCallback LDKFutureCallback_init (JSValue o) {
11003         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
11004         atomic_init(&calls->refcnt, 1);
11005         calls->instance_ptr = o;
11006
11007         LDKFutureCallback ret = {
11008                 .this_arg = (void*) calls,
11009                 .call = call_LDKFutureCallback_jcall,
11010                 .free = LDKFutureCallback_JCalls_free,
11011         };
11012         return ret;
11013 }
11014 uint64_t  __attribute__((export_name("TS_LDKFutureCallback_new"))) TS_LDKFutureCallback_new(JSValue o) {
11015         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
11016         *res_ptr = LDKFutureCallback_init(o);
11017         return tag_ptr(res_ptr, true);
11018 }
11019 void  __attribute__((export_name("TS_FutureCallback_call"))) TS_FutureCallback_call(uint64_t this_arg) {
11020         void* this_arg_ptr = untag_ptr(this_arg);
11021         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11022         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
11023         (this_arg_conv->call)(this_arg_conv->this_arg);
11024 }
11025
11026 typedef struct LDKListen_JCalls {
11027         atomic_size_t refcnt;
11028         uint32_t instance_ptr;
11029 } LDKListen_JCalls;
11030 static void LDKListen_JCalls_free(void* this_arg) {
11031         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11032         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11033                 FREE(j_calls);
11034         }
11035 }
11036 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11037         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11038         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11039         memcpy(header_arr->elems, *header, 80);
11040         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11041         uint64_tArray txdata_arr = NULL;
11042         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
11043         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
11044         for (size_t c = 0; c < txdata_var.datalen; c++) {
11045                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11046                 *txdata_conv_28_conv = txdata_var.data[c];
11047                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
11048         }
11049         
11050         FREE(txdata_var.data);
11051         int32_t height_conv = height;
11052         js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
11053 }
11054 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
11055         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11056         LDKu8slice block_var = block;
11057         int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__);
11058         memcpy(block_arr->elems, block_var.data, block_var.datalen);
11059         int32_t height_conv = height;
11060         js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)block_arr, height_conv, 0, 0, 0, 0);
11061 }
11062 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11063         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
11064         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11065         memcpy(header_arr->elems, *header, 80);
11066         int32_t height_conv = height;
11067         js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
11068 }
11069 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
11070         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
11071         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11072 }
11073 static inline LDKListen LDKListen_init (JSValue o) {
11074         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
11075         atomic_init(&calls->refcnt, 1);
11076         calls->instance_ptr = o;
11077
11078         LDKListen ret = {
11079                 .this_arg = (void*) calls,
11080                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
11081                 .block_connected = block_connected_LDKListen_jcall,
11082                 .block_disconnected = block_disconnected_LDKListen_jcall,
11083                 .free = LDKListen_JCalls_free,
11084         };
11085         return ret;
11086 }
11087 uint64_t  __attribute__((export_name("TS_LDKListen_new"))) TS_LDKListen_new(JSValue o) {
11088         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
11089         *res_ptr = LDKListen_init(o);
11090         return tag_ptr(res_ptr, true);
11091 }
11092 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) {
11093         void* this_arg_ptr = untag_ptr(this_arg);
11094         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11095         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11096         uint8_t header_arr[80];
11097         CHECK(header->arr_len == 80);
11098         memcpy(header_arr, header->elems, 80); FREE(header);
11099         uint8_t (*header_ref)[80] = &header_arr;
11100         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11101         txdata_constr.datalen = txdata->arr_len;
11102         if (txdata_constr.datalen > 0)
11103                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11104         else
11105                 txdata_constr.data = NULL;
11106         uint64_t* txdata_vals = txdata->elems;
11107         for (size_t c = 0; c < txdata_constr.datalen; c++) {
11108                 uint64_t txdata_conv_28 = txdata_vals[c];
11109                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
11110                 CHECK_ACCESS(txdata_conv_28_ptr);
11111                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11112                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
11113                 txdata_constr.data[c] = txdata_conv_28_conv;
11114         }
11115         FREE(txdata);
11116         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11117 }
11118
11119 void  __attribute__((export_name("TS_Listen_block_connected"))) TS_Listen_block_connected(uint64_t this_arg, int8_tArray block, int32_t height) {
11120         void* this_arg_ptr = untag_ptr(this_arg);
11121         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11122         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11123         LDKu8slice block_ref;
11124         block_ref.datalen = block->arr_len;
11125         block_ref.data = block->elems;
11126         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
11127         FREE(block);
11128 }
11129
11130 void  __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_block_disconnected(uint64_t this_arg, int8_tArray header, int32_t height) {
11131         void* this_arg_ptr = untag_ptr(this_arg);
11132         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11133         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
11134         uint8_t header_arr[80];
11135         CHECK(header->arr_len == 80);
11136         memcpy(header_arr, header->elems, 80); FREE(header);
11137         uint8_t (*header_ref)[80] = &header_arr;
11138         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
11139 }
11140
11141 typedef struct LDKConfirm_JCalls {
11142         atomic_size_t refcnt;
11143         uint32_t instance_ptr;
11144 } LDKConfirm_JCalls;
11145 static void LDKConfirm_JCalls_free(void* this_arg) {
11146         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11147         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11148                 FREE(j_calls);
11149         }
11150 }
11151 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
11152         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11153         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11154         memcpy(header_arr->elems, *header, 80);
11155         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
11156         uint64_tArray txdata_arr = NULL;
11157         txdata_arr = init_uint64_tArray(txdata_var.datalen, __LINE__);
11158         uint64_t *txdata_arr_ptr = (uint64_t*)(((uint8_t*)txdata_arr) + 8);
11159         for (size_t c = 0; c < txdata_var.datalen; c++) {
11160                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
11161                 *txdata_conv_28_conv = txdata_var.data[c];
11162                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
11163         }
11164         
11165         FREE(txdata_var.data);
11166         int32_t height_conv = height;
11167         js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0);
11168 }
11169 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
11170         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11171         int8_tArray txid_arr = init_int8_tArray(32, __LINE__);
11172         memcpy(txid_arr->elems, *txid, 32);
11173         js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)txid_arr, 0, 0, 0, 0, 0);
11174 }
11175 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
11176         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11177         int8_tArray header_arr = init_int8_tArray(80, __LINE__);
11178         memcpy(header_arr->elems, *header, 80);
11179         int32_t height_conv = height;
11180         js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)header_arr, height_conv, 0, 0, 0, 0);
11181 }
11182 LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
11183         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
11184         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0);
11185         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_constr;
11186         ret_constr.datalen = ret->arr_len;
11187         if (ret_constr.datalen > 0)
11188                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ Elements");
11189         else
11190                 ret_constr.data = NULL;
11191         uint64_t* ret_vals = ret->elems;
11192         for (size_t i = 0; i < ret_constr.datalen; i++) {
11193                 uint64_t ret_conv_34 = ret_vals[i];
11194                 void* ret_conv_34_ptr = untag_ptr(ret_conv_34);
11195                 CHECK_ACCESS(ret_conv_34_ptr);
11196                 LDKC2Tuple_TxidCOption_BlockHashZZ ret_conv_34_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(ret_conv_34_ptr);
11197                 FREE(untag_ptr(ret_conv_34));
11198                 ret_constr.data[i] = ret_conv_34_conv;
11199         }
11200         FREE(ret);
11201         return ret_constr;
11202 }
11203 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
11204         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
11205         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11206 }
11207 static inline LDKConfirm LDKConfirm_init (JSValue o) {
11208         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
11209         atomic_init(&calls->refcnt, 1);
11210         calls->instance_ptr = o;
11211
11212         LDKConfirm ret = {
11213                 .this_arg = (void*) calls,
11214                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
11215                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
11216                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
11217                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
11218                 .free = LDKConfirm_JCalls_free,
11219         };
11220         return ret;
11221 }
11222 uint64_t  __attribute__((export_name("TS_LDKConfirm_new"))) TS_LDKConfirm_new(JSValue o) {
11223         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
11224         *res_ptr = LDKConfirm_init(o);
11225         return tag_ptr(res_ptr, true);
11226 }
11227 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) {
11228         void* this_arg_ptr = untag_ptr(this_arg);
11229         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11230         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11231         uint8_t header_arr[80];
11232         CHECK(header->arr_len == 80);
11233         memcpy(header_arr, header->elems, 80); FREE(header);
11234         uint8_t (*header_ref)[80] = &header_arr;
11235         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
11236         txdata_constr.datalen = txdata->arr_len;
11237         if (txdata_constr.datalen > 0)
11238                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
11239         else
11240                 txdata_constr.data = NULL;
11241         uint64_t* txdata_vals = txdata->elems;
11242         for (size_t c = 0; c < txdata_constr.datalen; c++) {
11243                 uint64_t txdata_conv_28 = txdata_vals[c];
11244                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
11245                 CHECK_ACCESS(txdata_conv_28_ptr);
11246                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
11247                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
11248                 txdata_constr.data[c] = txdata_conv_28_conv;
11249         }
11250         FREE(txdata);
11251         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
11252 }
11253
11254 void  __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Confirm_transaction_unconfirmed(uint64_t this_arg, int8_tArray txid) {
11255         void* this_arg_ptr = untag_ptr(this_arg);
11256         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11257         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11258         uint8_t txid_arr[32];
11259         CHECK(txid->arr_len == 32);
11260         memcpy(txid_arr, txid->elems, 32); FREE(txid);
11261         uint8_t (*txid_ref)[32] = &txid_arr;
11262         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
11263 }
11264
11265 void  __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_best_block_updated(uint64_t this_arg, int8_tArray header, int32_t height) {
11266         void* this_arg_ptr = untag_ptr(this_arg);
11267         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11268         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11269         uint8_t header_arr[80];
11270         CHECK(header->arr_len == 80);
11271         memcpy(header_arr, header->elems, 80); FREE(header);
11272         uint8_t (*header_ref)[80] = &header_arr;
11273         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
11274 }
11275
11276 uint64_tArray  __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) {
11277         void* this_arg_ptr = untag_ptr(this_arg);
11278         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11279         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
11280         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
11281         uint64_tArray ret_arr = NULL;
11282         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11283         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11284         for (size_t i = 0; i < ret_var.datalen; i++) {
11285                 LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv_34_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
11286                 *ret_conv_34_conv = ret_var.data[i];
11287                 ret_arr_ptr[i] = tag_ptr(ret_conv_34_conv, true);
11288         }
11289         
11290         FREE(ret_var.data);
11291         return ret_arr;
11292 }
11293
11294 typedef struct LDKPersist_JCalls {
11295         atomic_size_t refcnt;
11296         uint32_t instance_ptr;
11297 } LDKPersist_JCalls;
11298 static void LDKPersist_JCalls_free(void* this_arg) {
11299         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11300         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11301                 FREE(j_calls);
11302         }
11303 }
11304 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11305         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11306         LDKOutPoint channel_id_var = channel_id;
11307         uint64_t channel_id_ref = 0;
11308         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11309         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11310         LDKChannelMonitor data_var = *data;
11311         uint64_t data_ref = 0;
11312         data_var = ChannelMonitor_clone(&data_var);
11313         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11314         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11315         LDKMonitorUpdateId update_id_var = update_id;
11316         uint64_t update_id_ref = 0;
11317         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11318         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11319         uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 62, channel_id_ref, data_ref, update_id_ref, 0, 0, 0);
11320         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
11321         return ret_conv;
11322 }
11323 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
11324         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
11325         LDKOutPoint channel_id_var = channel_id;
11326         uint64_t channel_id_ref = 0;
11327         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
11328         channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned);
11329         LDKChannelMonitorUpdate update_var = update;
11330         uint64_t update_ref = 0;
11331         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
11332         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
11333         LDKChannelMonitor data_var = *data;
11334         uint64_t data_ref = 0;
11335         data_var = ChannelMonitor_clone(&data_var);
11336         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
11337         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
11338         LDKMonitorUpdateId update_id_var = update_id;
11339         uint64_t update_id_ref = 0;
11340         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
11341         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
11342         uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 63, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0);
11343         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret);
11344         return ret_conv;
11345 }
11346 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
11347         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
11348         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11349 }
11350 static inline LDKPersist LDKPersist_init (JSValue o) {
11351         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
11352         atomic_init(&calls->refcnt, 1);
11353         calls->instance_ptr = o;
11354
11355         LDKPersist ret = {
11356                 .this_arg = (void*) calls,
11357                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
11358                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
11359                 .free = LDKPersist_JCalls_free,
11360         };
11361         return ret;
11362 }
11363 uint64_t  __attribute__((export_name("TS_LDKPersist_new"))) TS_LDKPersist_new(JSValue o) {
11364         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
11365         *res_ptr = LDKPersist_init(o);
11366         return tag_ptr(res_ptr, true);
11367 }
11368 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) {
11369         void* this_arg_ptr = untag_ptr(this_arg);
11370         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11371         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11372         LDKOutPoint channel_id_conv;
11373         channel_id_conv.inner = untag_ptr(channel_id);
11374         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11375         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11376         channel_id_conv = OutPoint_clone(&channel_id_conv);
11377         LDKChannelMonitor data_conv;
11378         data_conv.inner = untag_ptr(data);
11379         data_conv.is_owned = ptr_is_owned(data);
11380         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11381         data_conv.is_owned = false;
11382         LDKMonitorUpdateId update_id_conv;
11383         update_id_conv.inner = untag_ptr(update_id);
11384         update_id_conv.is_owned = ptr_is_owned(update_id);
11385         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11386         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11387         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));
11388         return ret_conv;
11389 }
11390
11391 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) {
11392         void* this_arg_ptr = untag_ptr(this_arg);
11393         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11394         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
11395         LDKOutPoint channel_id_conv;
11396         channel_id_conv.inner = untag_ptr(channel_id);
11397         channel_id_conv.is_owned = ptr_is_owned(channel_id);
11398         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
11399         channel_id_conv = OutPoint_clone(&channel_id_conv);
11400         LDKChannelMonitorUpdate update_conv;
11401         update_conv.inner = untag_ptr(update);
11402         update_conv.is_owned = ptr_is_owned(update);
11403         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
11404         update_conv = ChannelMonitorUpdate_clone(&update_conv);
11405         LDKChannelMonitor data_conv;
11406         data_conv.inner = untag_ptr(data);
11407         data_conv.is_owned = ptr_is_owned(data);
11408         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
11409         data_conv.is_owned = false;
11410         LDKMonitorUpdateId update_id_conv;
11411         update_id_conv.inner = untag_ptr(update_id);
11412         update_id_conv.is_owned = ptr_is_owned(update_id);
11413         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
11414         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
11415         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));
11416         return ret_conv;
11417 }
11418
11419 typedef struct LDKEventHandler_JCalls {
11420         atomic_size_t refcnt;
11421         uint32_t instance_ptr;
11422 } LDKEventHandler_JCalls;
11423 static void LDKEventHandler_JCalls_free(void* this_arg) {
11424         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
11425         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11426                 FREE(j_calls);
11427         }
11428 }
11429 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
11430         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
11431         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
11432         *event_copy = event;
11433         uint64_t event_ref = tag_ptr(event_copy, true);
11434         js_invoke_function_buuuuu(j_calls->instance_ptr, 64, event_ref, 0, 0, 0, 0, 0);
11435 }
11436 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
11437         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
11438         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11439 }
11440 static inline LDKEventHandler LDKEventHandler_init (JSValue o) {
11441         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
11442         atomic_init(&calls->refcnt, 1);
11443         calls->instance_ptr = o;
11444
11445         LDKEventHandler ret = {
11446                 .this_arg = (void*) calls,
11447                 .handle_event = handle_event_LDKEventHandler_jcall,
11448                 .free = LDKEventHandler_JCalls_free,
11449         };
11450         return ret;
11451 }
11452 uint64_t  __attribute__((export_name("TS_LDKEventHandler_new"))) TS_LDKEventHandler_new(JSValue o) {
11453         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
11454         *res_ptr = LDKEventHandler_init(o);
11455         return tag_ptr(res_ptr, true);
11456 }
11457 void  __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandler_handle_event(uint64_t this_arg, uint64_t event) {
11458         void* this_arg_ptr = untag_ptr(this_arg);
11459         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11460         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
11461         void* event_ptr = untag_ptr(event);
11462         CHECK_ACCESS(event_ptr);
11463         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
11464         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
11465         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
11466 }
11467
11468 typedef struct LDKEventsProvider_JCalls {
11469         atomic_size_t refcnt;
11470         uint32_t instance_ptr;
11471 } LDKEventsProvider_JCalls;
11472 static void LDKEventsProvider_JCalls_free(void* this_arg) {
11473         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
11474         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11475                 FREE(j_calls);
11476         }
11477 }
11478 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
11479         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
11480         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
11481         *handler_ret = handler;
11482         js_invoke_function_buuuuu(j_calls->instance_ptr, 65, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0);
11483 }
11484 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
11485         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
11486         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11487 }
11488 static inline LDKEventsProvider LDKEventsProvider_init (JSValue o) {
11489         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
11490         atomic_init(&calls->refcnt, 1);
11491         calls->instance_ptr = o;
11492
11493         LDKEventsProvider ret = {
11494                 .this_arg = (void*) calls,
11495                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
11496                 .free = LDKEventsProvider_JCalls_free,
11497         };
11498         return ret;
11499 }
11500 uint64_t  __attribute__((export_name("TS_LDKEventsProvider_new"))) TS_LDKEventsProvider_new(JSValue o) {
11501         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
11502         *res_ptr = LDKEventsProvider_init(o);
11503         return tag_ptr(res_ptr, true);
11504 }
11505 void  __attribute__((export_name("TS_EventsProvider_process_pending_events"))) TS_EventsProvider_process_pending_events(uint64_t this_arg, uint64_t handler) {
11506         void* this_arg_ptr = untag_ptr(this_arg);
11507         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11508         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
11509         void* handler_ptr = untag_ptr(handler);
11510         CHECK_ACCESS(handler_ptr);
11511         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
11512         if (handler_conv.free == LDKEventHandler_JCalls_free) {
11513                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11514                 LDKEventHandler_JCalls_cloned(&handler_conv);
11515         }
11516         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
11517 }
11518
11519 uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) {
11520         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11521         switch(obj->tag) {
11522                 case LDKRetry_Attempts: return 0;
11523                 default: abort();
11524         }
11525 }
11526 uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) {
11527         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
11528         assert(obj->tag == LDKRetry_Attempts);
11529                         uint32_t attempts_conv = obj->attempts;
11530         return attempts_conv;
11531 }
11532 typedef struct LDKMessageSendEventsProvider_JCalls {
11533         atomic_size_t refcnt;
11534         uint32_t instance_ptr;
11535 } LDKMessageSendEventsProvider_JCalls;
11536 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
11537         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
11538         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11539                 FREE(j_calls);
11540         }
11541 }
11542 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
11543         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
11544         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 66, 0, 0, 0, 0, 0, 0);
11545         LDKCVec_MessageSendEventZ ret_constr;
11546         ret_constr.datalen = ret->arr_len;
11547         if (ret_constr.datalen > 0)
11548                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
11549         else
11550                 ret_constr.data = NULL;
11551         uint64_t* ret_vals = ret->elems;
11552         for (size_t s = 0; s < ret_constr.datalen; s++) {
11553                 uint64_t ret_conv_18 = ret_vals[s];
11554                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
11555                 CHECK_ACCESS(ret_conv_18_ptr);
11556                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
11557                 FREE(untag_ptr(ret_conv_18));
11558                 ret_constr.data[s] = ret_conv_18_conv;
11559         }
11560         FREE(ret);
11561         return ret_constr;
11562 }
11563 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
11564         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
11565         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11566 }
11567 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JSValue o) {
11568         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
11569         atomic_init(&calls->refcnt, 1);
11570         calls->instance_ptr = o;
11571
11572         LDKMessageSendEventsProvider ret = {
11573                 .this_arg = (void*) calls,
11574                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
11575                 .free = LDKMessageSendEventsProvider_JCalls_free,
11576         };
11577         return ret;
11578 }
11579 uint64_t  __attribute__((export_name("TS_LDKMessageSendEventsProvider_new"))) TS_LDKMessageSendEventsProvider_new(JSValue o) {
11580         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
11581         *res_ptr = LDKMessageSendEventsProvider_init(o);
11582         return tag_ptr(res_ptr, true);
11583 }
11584 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) {
11585         void* this_arg_ptr = untag_ptr(this_arg);
11586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11587         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
11588         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
11589         uint64_tArray ret_arr = NULL;
11590         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
11591         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
11592         for (size_t s = 0; s < ret_var.datalen; s++) {
11593                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
11594                 *ret_conv_18_copy = ret_var.data[s];
11595                 uint64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
11596                 ret_arr_ptr[s] = ret_conv_18_ref;
11597         }
11598         
11599         FREE(ret_var.data);
11600         return ret_arr;
11601 }
11602
11603 typedef struct LDKChannelMessageHandler_JCalls {
11604         atomic_size_t refcnt;
11605         uint32_t instance_ptr;
11606         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
11607 } LDKChannelMessageHandler_JCalls;
11608 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
11609         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11610         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11611                 FREE(j_calls);
11612         }
11613 }
11614 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
11615         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11616         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11617         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11618         LDKOpenChannel msg_var = *msg;
11619         uint64_t msg_ref = 0;
11620         msg_var = OpenChannel_clone(&msg_var);
11621         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11622         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11623         js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11624 }
11625 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
11626         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11627         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11628         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11629         LDKOpenChannelV2 msg_var = *msg;
11630         uint64_t msg_ref = 0;
11631         msg_var = OpenChannelV2_clone(&msg_var);
11632         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11633         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11634         js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11635 }
11636 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
11637         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11638         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11639         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11640         LDKAcceptChannel msg_var = *msg;
11641         uint64_t msg_ref = 0;
11642         msg_var = AcceptChannel_clone(&msg_var);
11643         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11644         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11645         js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11646 }
11647 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
11648         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11649         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11650         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11651         LDKAcceptChannelV2 msg_var = *msg;
11652         uint64_t msg_ref = 0;
11653         msg_var = AcceptChannelV2_clone(&msg_var);
11654         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11655         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11656         js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11657 }
11658 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
11659         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11660         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11661         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11662         LDKFundingCreated msg_var = *msg;
11663         uint64_t msg_ref = 0;
11664         msg_var = FundingCreated_clone(&msg_var);
11665         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11666         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11667         js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11668 }
11669 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
11670         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11671         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11672         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11673         LDKFundingSigned msg_var = *msg;
11674         uint64_t msg_ref = 0;
11675         msg_var = FundingSigned_clone(&msg_var);
11676         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11677         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11678         js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11679 }
11680 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
11681         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11682         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11683         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11684         LDKChannelReady msg_var = *msg;
11685         uint64_t msg_ref = 0;
11686         msg_var = ChannelReady_clone(&msg_var);
11687         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11688         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11689         js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11690 }
11691 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
11692         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11693         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11694         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11695         LDKShutdown msg_var = *msg;
11696         uint64_t msg_ref = 0;
11697         msg_var = Shutdown_clone(&msg_var);
11698         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11699         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11700         js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11701 }
11702 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
11703         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11704         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11705         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11706         LDKClosingSigned msg_var = *msg;
11707         uint64_t msg_ref = 0;
11708         msg_var = ClosingSigned_clone(&msg_var);
11709         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11710         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11711         js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11712 }
11713 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
11714         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11715         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11716         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11717         LDKTxAddInput msg_var = *msg;
11718         uint64_t msg_ref = 0;
11719         msg_var = TxAddInput_clone(&msg_var);
11720         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11721         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11722         js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11723 }
11724 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
11725         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11726         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11727         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11728         LDKTxAddOutput msg_var = *msg;
11729         uint64_t msg_ref = 0;
11730         msg_var = TxAddOutput_clone(&msg_var);
11731         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11732         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11733         js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11734 }
11735 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
11736         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11737         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11738         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11739         LDKTxRemoveInput msg_var = *msg;
11740         uint64_t msg_ref = 0;
11741         msg_var = TxRemoveInput_clone(&msg_var);
11742         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11743         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11744         js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11745 }
11746 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
11747         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11748         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11749         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11750         LDKTxRemoveOutput msg_var = *msg;
11751         uint64_t msg_ref = 0;
11752         msg_var = TxRemoveOutput_clone(&msg_var);
11753         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11754         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11755         js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11756 }
11757 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
11758         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11759         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11760         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11761         LDKTxComplete msg_var = *msg;
11762         uint64_t msg_ref = 0;
11763         msg_var = TxComplete_clone(&msg_var);
11764         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11765         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11766         js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11767 }
11768 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
11769         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11770         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11771         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11772         LDKTxSignatures msg_var = *msg;
11773         uint64_t msg_ref = 0;
11774         msg_var = TxSignatures_clone(&msg_var);
11775         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11776         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11777         js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11778 }
11779 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
11780         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11781         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11782         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11783         LDKTxInitRbf msg_var = *msg;
11784         uint64_t msg_ref = 0;
11785         msg_var = TxInitRbf_clone(&msg_var);
11786         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11787         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11788         js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11789 }
11790 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
11791         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11792         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11793         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11794         LDKTxAckRbf msg_var = *msg;
11795         uint64_t msg_ref = 0;
11796         msg_var = TxAckRbf_clone(&msg_var);
11797         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11798         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11799         js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11800 }
11801 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
11802         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11803         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11804         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11805         LDKTxAbort msg_var = *msg;
11806         uint64_t msg_ref = 0;
11807         msg_var = TxAbort_clone(&msg_var);
11808         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11809         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11810         js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11811 }
11812 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
11813         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11814         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11815         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11816         LDKUpdateAddHTLC msg_var = *msg;
11817         uint64_t msg_ref = 0;
11818         msg_var = UpdateAddHTLC_clone(&msg_var);
11819         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11820         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11821         js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11822 }
11823 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
11824         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11825         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11826         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11827         LDKUpdateFulfillHTLC msg_var = *msg;
11828         uint64_t msg_ref = 0;
11829         msg_var = UpdateFulfillHTLC_clone(&msg_var);
11830         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11831         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11832         js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11833 }
11834 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
11835         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11836         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11837         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11838         LDKUpdateFailHTLC msg_var = *msg;
11839         uint64_t msg_ref = 0;
11840         msg_var = UpdateFailHTLC_clone(&msg_var);
11841         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11842         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11843         js_invoke_function_ubuuuu(j_calls->instance_ptr, 87, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11844 }
11845 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
11846         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11847         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11848         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11849         LDKUpdateFailMalformedHTLC msg_var = *msg;
11850         uint64_t msg_ref = 0;
11851         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
11852         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11853         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11854         js_invoke_function_ubuuuu(j_calls->instance_ptr, 88, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11855 }
11856 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
11857         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11858         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11859         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11860         LDKCommitmentSigned msg_var = *msg;
11861         uint64_t msg_ref = 0;
11862         msg_var = CommitmentSigned_clone(&msg_var);
11863         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11864         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11865         js_invoke_function_ubuuuu(j_calls->instance_ptr, 89, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11866 }
11867 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
11868         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11869         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11870         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11871         LDKRevokeAndACK msg_var = *msg;
11872         uint64_t msg_ref = 0;
11873         msg_var = RevokeAndACK_clone(&msg_var);
11874         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11875         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11876         js_invoke_function_ubuuuu(j_calls->instance_ptr, 90, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11877 }
11878 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
11879         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11880         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11881         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11882         LDKUpdateFee msg_var = *msg;
11883         uint64_t msg_ref = 0;
11884         msg_var = UpdateFee_clone(&msg_var);
11885         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11886         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11887         js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11888 }
11889 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
11890         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11891         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11892         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11893         LDKAnnouncementSignatures msg_var = *msg;
11894         uint64_t msg_ref = 0;
11895         msg_var = AnnouncementSignatures_clone(&msg_var);
11896         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11897         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11898         js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11899 }
11900 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
11901         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11902         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11903         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11904         js_invoke_function_uuuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
11905 }
11906 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
11907         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11908         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11909         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11910         LDKInit msg_var = *msg;
11911         uint64_t msg_ref = 0;
11912         msg_var = Init_clone(&msg_var);
11913         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11914         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11915         jboolean inbound_conv = inbound;
11916         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0);
11917         void* ret_ptr = untag_ptr(ret);
11918         CHECK_ACCESS(ret_ptr);
11919         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
11920         FREE(untag_ptr(ret));
11921         return ret_conv;
11922 }
11923 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
11924         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11925         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11926         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11927         LDKChannelReestablish msg_var = *msg;
11928         uint64_t msg_ref = 0;
11929         msg_var = ChannelReestablish_clone(&msg_var);
11930         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11931         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11932         js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11933 }
11934 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
11935         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11936         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11937         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11938         LDKChannelUpdate msg_var = *msg;
11939         uint64_t msg_ref = 0;
11940         msg_var = ChannelUpdate_clone(&msg_var);
11941         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11942         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11943         js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11944 }
11945 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
11946         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11947         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11948         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11949         LDKErrorMessage msg_var = *msg;
11950         uint64_t msg_ref = 0;
11951         msg_var = ErrorMessage_clone(&msg_var);
11952         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
11953         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
11954         js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
11955 }
11956 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
11957         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11958         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, 0, 0, 0, 0, 0, 0);
11959         LDKNodeFeatures ret_conv;
11960         ret_conv.inner = untag_ptr(ret);
11961         ret_conv.is_owned = ptr_is_owned(ret);
11962         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11963         return ret_conv;
11964 }
11965 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
11966         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11967         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
11968         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
11969         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
11970         LDKInitFeatures ret_conv;
11971         ret_conv.inner = untag_ptr(ret);
11972         ret_conv.is_owned = ptr_is_owned(ret);
11973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
11974         return ret_conv;
11975 }
11976 LDKCOption_CVec_ChainHashZZ get_genesis_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
11977         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
11978         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, 0, 0, 0, 0, 0, 0);
11979         void* ret_ptr = untag_ptr(ret);
11980         CHECK_ACCESS(ret_ptr);
11981         LDKCOption_CVec_ChainHashZZ ret_conv = *(LDKCOption_CVec_ChainHashZZ*)(ret_ptr);
11982         FREE(untag_ptr(ret));
11983         return ret_conv;
11984 }
11985 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
11986         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
11987         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11988         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
11989 }
11990 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
11991         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
11992         atomic_init(&calls->refcnt, 1);
11993         calls->instance_ptr = o;
11994
11995         LDKChannelMessageHandler ret = {
11996                 .this_arg = (void*) calls,
11997                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
11998                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
11999                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
12000                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
12001                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
12002                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
12003                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
12004                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
12005                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
12006                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
12007                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
12008                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
12009                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
12010                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
12011                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
12012                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
12013                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
12014                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
12015                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
12016                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
12017                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
12018                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
12019                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
12020                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
12021                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
12022                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
12023                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
12024                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
12025                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
12026                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
12027                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
12028                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
12029                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
12030                 .get_genesis_hashes = get_genesis_hashes_LDKChannelMessageHandler_jcall,
12031                 .free = LDKChannelMessageHandler_JCalls_free,
12032                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
12033         };
12034         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12035         return ret;
12036 }
12037 uint64_t  __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDKChannelMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
12038         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
12039         *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider);
12040         return tag_ptr(res_ptr, true);
12041 }
12042 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) {
12043         void* this_arg_ptr = untag_ptr(this_arg);
12044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12045         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12046         LDKPublicKey their_node_id_ref;
12047         CHECK(their_node_id->arr_len == 33);
12048         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12049         LDKOpenChannel msg_conv;
12050         msg_conv.inner = untag_ptr(msg);
12051         msg_conv.is_owned = ptr_is_owned(msg);
12052         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12053         msg_conv.is_owned = false;
12054         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12055 }
12056
12057 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) {
12058         void* this_arg_ptr = untag_ptr(this_arg);
12059         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12060         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12061         LDKPublicKey their_node_id_ref;
12062         CHECK(their_node_id->arr_len == 33);
12063         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12064         LDKOpenChannelV2 msg_conv;
12065         msg_conv.inner = untag_ptr(msg);
12066         msg_conv.is_owned = ptr_is_owned(msg);
12067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12068         msg_conv.is_owned = false;
12069         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12070 }
12071
12072 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) {
12073         void* this_arg_ptr = untag_ptr(this_arg);
12074         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12075         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12076         LDKPublicKey their_node_id_ref;
12077         CHECK(their_node_id->arr_len == 33);
12078         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12079         LDKAcceptChannel msg_conv;
12080         msg_conv.inner = untag_ptr(msg);
12081         msg_conv.is_owned = ptr_is_owned(msg);
12082         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12083         msg_conv.is_owned = false;
12084         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12085 }
12086
12087 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) {
12088         void* this_arg_ptr = untag_ptr(this_arg);
12089         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12090         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12091         LDKPublicKey their_node_id_ref;
12092         CHECK(their_node_id->arr_len == 33);
12093         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12094         LDKAcceptChannelV2 msg_conv;
12095         msg_conv.inner = untag_ptr(msg);
12096         msg_conv.is_owned = ptr_is_owned(msg);
12097         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12098         msg_conv.is_owned = false;
12099         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12100 }
12101
12102 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) {
12103         void* this_arg_ptr = untag_ptr(this_arg);
12104         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12105         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12106         LDKPublicKey their_node_id_ref;
12107         CHECK(their_node_id->arr_len == 33);
12108         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12109         LDKFundingCreated msg_conv;
12110         msg_conv.inner = untag_ptr(msg);
12111         msg_conv.is_owned = ptr_is_owned(msg);
12112         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12113         msg_conv.is_owned = false;
12114         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12115 }
12116
12117 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) {
12118         void* this_arg_ptr = untag_ptr(this_arg);
12119         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12120         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12121         LDKPublicKey their_node_id_ref;
12122         CHECK(their_node_id->arr_len == 33);
12123         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12124         LDKFundingSigned msg_conv;
12125         msg_conv.inner = untag_ptr(msg);
12126         msg_conv.is_owned = ptr_is_owned(msg);
12127         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12128         msg_conv.is_owned = false;
12129         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12130 }
12131
12132 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) {
12133         void* this_arg_ptr = untag_ptr(this_arg);
12134         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12135         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12136         LDKPublicKey their_node_id_ref;
12137         CHECK(their_node_id->arr_len == 33);
12138         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12139         LDKChannelReady msg_conv;
12140         msg_conv.inner = untag_ptr(msg);
12141         msg_conv.is_owned = ptr_is_owned(msg);
12142         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12143         msg_conv.is_owned = false;
12144         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12145 }
12146
12147 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
12148         void* this_arg_ptr = untag_ptr(this_arg);
12149         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12150         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12151         LDKPublicKey their_node_id_ref;
12152         CHECK(their_node_id->arr_len == 33);
12153         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12154         LDKShutdown msg_conv;
12155         msg_conv.inner = untag_ptr(msg);
12156         msg_conv.is_owned = ptr_is_owned(msg);
12157         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12158         msg_conv.is_owned = false;
12159         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12160 }
12161
12162 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) {
12163         void* this_arg_ptr = untag_ptr(this_arg);
12164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12165         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12166         LDKPublicKey their_node_id_ref;
12167         CHECK(their_node_id->arr_len == 33);
12168         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12169         LDKClosingSigned msg_conv;
12170         msg_conv.inner = untag_ptr(msg);
12171         msg_conv.is_owned = ptr_is_owned(msg);
12172         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12173         msg_conv.is_owned = false;
12174         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12175 }
12176
12177 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) {
12178         void* this_arg_ptr = untag_ptr(this_arg);
12179         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12180         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12181         LDKPublicKey their_node_id_ref;
12182         CHECK(their_node_id->arr_len == 33);
12183         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12184         LDKTxAddInput msg_conv;
12185         msg_conv.inner = untag_ptr(msg);
12186         msg_conv.is_owned = ptr_is_owned(msg);
12187         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12188         msg_conv.is_owned = false;
12189         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12190 }
12191
12192 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) {
12193         void* this_arg_ptr = untag_ptr(this_arg);
12194         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12195         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12196         LDKPublicKey their_node_id_ref;
12197         CHECK(their_node_id->arr_len == 33);
12198         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12199         LDKTxAddOutput msg_conv;
12200         msg_conv.inner = untag_ptr(msg);
12201         msg_conv.is_owned = ptr_is_owned(msg);
12202         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12203         msg_conv.is_owned = false;
12204         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12205 }
12206
12207 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) {
12208         void* this_arg_ptr = untag_ptr(this_arg);
12209         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12210         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12211         LDKPublicKey their_node_id_ref;
12212         CHECK(their_node_id->arr_len == 33);
12213         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12214         LDKTxRemoveInput msg_conv;
12215         msg_conv.inner = untag_ptr(msg);
12216         msg_conv.is_owned = ptr_is_owned(msg);
12217         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12218         msg_conv.is_owned = false;
12219         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12220 }
12221
12222 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) {
12223         void* this_arg_ptr = untag_ptr(this_arg);
12224         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12225         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12226         LDKPublicKey their_node_id_ref;
12227         CHECK(their_node_id->arr_len == 33);
12228         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12229         LDKTxRemoveOutput msg_conv;
12230         msg_conv.inner = untag_ptr(msg);
12231         msg_conv.is_owned = ptr_is_owned(msg);
12232         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12233         msg_conv.is_owned = false;
12234         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12235 }
12236
12237 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) {
12238         void* this_arg_ptr = untag_ptr(this_arg);
12239         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12240         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12241         LDKPublicKey their_node_id_ref;
12242         CHECK(their_node_id->arr_len == 33);
12243         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12244         LDKTxComplete msg_conv;
12245         msg_conv.inner = untag_ptr(msg);
12246         msg_conv.is_owned = ptr_is_owned(msg);
12247         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12248         msg_conv.is_owned = false;
12249         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12250 }
12251
12252 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) {
12253         void* this_arg_ptr = untag_ptr(this_arg);
12254         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12255         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12256         LDKPublicKey their_node_id_ref;
12257         CHECK(their_node_id->arr_len == 33);
12258         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12259         LDKTxSignatures msg_conv;
12260         msg_conv.inner = untag_ptr(msg);
12261         msg_conv.is_owned = ptr_is_owned(msg);
12262         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12263         msg_conv.is_owned = false;
12264         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12265 }
12266
12267 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) {
12268         void* this_arg_ptr = untag_ptr(this_arg);
12269         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12270         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12271         LDKPublicKey their_node_id_ref;
12272         CHECK(their_node_id->arr_len == 33);
12273         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12274         LDKTxInitRbf msg_conv;
12275         msg_conv.inner = untag_ptr(msg);
12276         msg_conv.is_owned = ptr_is_owned(msg);
12277         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12278         msg_conv.is_owned = false;
12279         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12280 }
12281
12282 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) {
12283         void* this_arg_ptr = untag_ptr(this_arg);
12284         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12285         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12286         LDKPublicKey their_node_id_ref;
12287         CHECK(their_node_id->arr_len == 33);
12288         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12289         LDKTxAckRbf msg_conv;
12290         msg_conv.inner = untag_ptr(msg);
12291         msg_conv.is_owned = ptr_is_owned(msg);
12292         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12293         msg_conv.is_owned = false;
12294         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12295 }
12296
12297 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) {
12298         void* this_arg_ptr = untag_ptr(this_arg);
12299         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12300         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12301         LDKPublicKey their_node_id_ref;
12302         CHECK(their_node_id->arr_len == 33);
12303         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12304         LDKTxAbort msg_conv;
12305         msg_conv.inner = untag_ptr(msg);
12306         msg_conv.is_owned = ptr_is_owned(msg);
12307         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12308         msg_conv.is_owned = false;
12309         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12310 }
12311
12312 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) {
12313         void* this_arg_ptr = untag_ptr(this_arg);
12314         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12315         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12316         LDKPublicKey their_node_id_ref;
12317         CHECK(their_node_id->arr_len == 33);
12318         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12319         LDKUpdateAddHTLC msg_conv;
12320         msg_conv.inner = untag_ptr(msg);
12321         msg_conv.is_owned = ptr_is_owned(msg);
12322         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12323         msg_conv.is_owned = false;
12324         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12325 }
12326
12327 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) {
12328         void* this_arg_ptr = untag_ptr(this_arg);
12329         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12330         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12331         LDKPublicKey their_node_id_ref;
12332         CHECK(their_node_id->arr_len == 33);
12333         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12334         LDKUpdateFulfillHTLC msg_conv;
12335         msg_conv.inner = untag_ptr(msg);
12336         msg_conv.is_owned = ptr_is_owned(msg);
12337         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12338         msg_conv.is_owned = false;
12339         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12340 }
12341
12342 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) {
12343         void* this_arg_ptr = untag_ptr(this_arg);
12344         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12345         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12346         LDKPublicKey their_node_id_ref;
12347         CHECK(their_node_id->arr_len == 33);
12348         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12349         LDKUpdateFailHTLC msg_conv;
12350         msg_conv.inner = untag_ptr(msg);
12351         msg_conv.is_owned = ptr_is_owned(msg);
12352         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12353         msg_conv.is_owned = false;
12354         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12355 }
12356
12357 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) {
12358         void* this_arg_ptr = untag_ptr(this_arg);
12359         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12360         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12361         LDKPublicKey their_node_id_ref;
12362         CHECK(their_node_id->arr_len == 33);
12363         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12364         LDKUpdateFailMalformedHTLC msg_conv;
12365         msg_conv.inner = untag_ptr(msg);
12366         msg_conv.is_owned = ptr_is_owned(msg);
12367         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12368         msg_conv.is_owned = false;
12369         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12370 }
12371
12372 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) {
12373         void* this_arg_ptr = untag_ptr(this_arg);
12374         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12375         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12376         LDKPublicKey their_node_id_ref;
12377         CHECK(their_node_id->arr_len == 33);
12378         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12379         LDKCommitmentSigned msg_conv;
12380         msg_conv.inner = untag_ptr(msg);
12381         msg_conv.is_owned = ptr_is_owned(msg);
12382         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12383         msg_conv.is_owned = false;
12384         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12385 }
12386
12387 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) {
12388         void* this_arg_ptr = untag_ptr(this_arg);
12389         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12390         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12391         LDKPublicKey their_node_id_ref;
12392         CHECK(their_node_id->arr_len == 33);
12393         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12394         LDKRevokeAndACK msg_conv;
12395         msg_conv.inner = untag_ptr(msg);
12396         msg_conv.is_owned = ptr_is_owned(msg);
12397         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12398         msg_conv.is_owned = false;
12399         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12400 }
12401
12402 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) {
12403         void* this_arg_ptr = untag_ptr(this_arg);
12404         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12405         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12406         LDKPublicKey their_node_id_ref;
12407         CHECK(their_node_id->arr_len == 33);
12408         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12409         LDKUpdateFee msg_conv;
12410         msg_conv.inner = untag_ptr(msg);
12411         msg_conv.is_owned = ptr_is_owned(msg);
12412         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12413         msg_conv.is_owned = false;
12414         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12415 }
12416
12417 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) {
12418         void* this_arg_ptr = untag_ptr(this_arg);
12419         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12420         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12421         LDKPublicKey their_node_id_ref;
12422         CHECK(their_node_id->arr_len == 33);
12423         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12424         LDKAnnouncementSignatures msg_conv;
12425         msg_conv.inner = untag_ptr(msg);
12426         msg_conv.is_owned = ptr_is_owned(msg);
12427         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12428         msg_conv.is_owned = false;
12429         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12430 }
12431
12432 void  __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
12433         void* this_arg_ptr = untag_ptr(this_arg);
12434         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12435         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12436         LDKPublicKey their_node_id_ref;
12437         CHECK(their_node_id->arr_len == 33);
12438         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12439         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
12440 }
12441
12442 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) {
12443         void* this_arg_ptr = untag_ptr(this_arg);
12444         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12445         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12446         LDKPublicKey their_node_id_ref;
12447         CHECK(their_node_id->arr_len == 33);
12448         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12449         LDKInit msg_conv;
12450         msg_conv.inner = untag_ptr(msg);
12451         msg_conv.is_owned = ptr_is_owned(msg);
12452         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12453         msg_conv.is_owned = false;
12454         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12455         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
12456         return tag_ptr(ret_conv, true);
12457 }
12458
12459 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) {
12460         void* this_arg_ptr = untag_ptr(this_arg);
12461         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12462         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12463         LDKPublicKey their_node_id_ref;
12464         CHECK(their_node_id->arr_len == 33);
12465         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12466         LDKChannelReestablish msg_conv;
12467         msg_conv.inner = untag_ptr(msg);
12468         msg_conv.is_owned = ptr_is_owned(msg);
12469         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12470         msg_conv.is_owned = false;
12471         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12472 }
12473
12474 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) {
12475         void* this_arg_ptr = untag_ptr(this_arg);
12476         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12477         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12478         LDKPublicKey their_node_id_ref;
12479         CHECK(their_node_id->arr_len == 33);
12480         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12481         LDKChannelUpdate msg_conv;
12482         msg_conv.inner = untag_ptr(msg);
12483         msg_conv.is_owned = ptr_is_owned(msg);
12484         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12485         msg_conv.is_owned = false;
12486         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12487 }
12488
12489 void  __attribute__((export_name("TS_ChannelMessageHandler_handle_error"))) TS_ChannelMessageHandler_handle_error(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) {
12490         void* this_arg_ptr = untag_ptr(this_arg);
12491         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12492         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12493         LDKPublicKey their_node_id_ref;
12494         CHECK(their_node_id->arr_len == 33);
12495         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12496         LDKErrorMessage msg_conv;
12497         msg_conv.inner = untag_ptr(msg);
12498         msg_conv.is_owned = ptr_is_owned(msg);
12499         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12500         msg_conv.is_owned = false;
12501         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
12502 }
12503
12504 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_node_features"))) TS_ChannelMessageHandler_provided_node_features(uint64_t this_arg) {
12505         void* this_arg_ptr = untag_ptr(this_arg);
12506         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12507         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12508         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
12509         uint64_t ret_ref = 0;
12510         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12511         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12512         return ret_ref;
12513 }
12514
12515 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_provided_init_features"))) TS_ChannelMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
12516         void* this_arg_ptr = untag_ptr(this_arg);
12517         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12518         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12519         LDKPublicKey their_node_id_ref;
12520         CHECK(their_node_id->arr_len == 33);
12521         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12522         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
12523         uint64_t ret_ref = 0;
12524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12526         return ret_ref;
12527 }
12528
12529 uint64_t  __attribute__((export_name("TS_ChannelMessageHandler_get_genesis_hashes"))) TS_ChannelMessageHandler_get_genesis_hashes(uint64_t this_arg) {
12530         void* this_arg_ptr = untag_ptr(this_arg);
12531         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12532         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
12533         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
12534         *ret_copy = (this_arg_conv->get_genesis_hashes)(this_arg_conv->this_arg);
12535         uint64_t ret_ref = tag_ptr(ret_copy, true);
12536         return ret_ref;
12537 }
12538
12539 typedef struct LDKRoutingMessageHandler_JCalls {
12540         atomic_size_t refcnt;
12541         uint32_t instance_ptr;
12542         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
12543 } LDKRoutingMessageHandler_JCalls;
12544 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
12545         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12546         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12547                 FREE(j_calls);
12548         }
12549 }
12550 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
12551         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12552         LDKNodeAnnouncement msg_var = *msg;
12553         uint64_t msg_ref = 0;
12554         msg_var = NodeAnnouncement_clone(&msg_var);
12555         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12556         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12557         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 101, msg_ref, 0, 0, 0, 0, 0);
12558         void* ret_ptr = untag_ptr(ret);
12559         CHECK_ACCESS(ret_ptr);
12560         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12561         FREE(untag_ptr(ret));
12562         return ret_conv;
12563 }
12564 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
12565         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12566         LDKChannelAnnouncement msg_var = *msg;
12567         uint64_t msg_ref = 0;
12568         msg_var = ChannelAnnouncement_clone(&msg_var);
12569         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12570         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12571         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 102, msg_ref, 0, 0, 0, 0, 0);
12572         void* ret_ptr = untag_ptr(ret);
12573         CHECK_ACCESS(ret_ptr);
12574         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12575         FREE(untag_ptr(ret));
12576         return ret_conv;
12577 }
12578 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
12579         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12580         LDKChannelUpdate msg_var = *msg;
12581         uint64_t msg_ref = 0;
12582         msg_var = ChannelUpdate_clone(&msg_var);
12583         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12584         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12585         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 103, msg_ref, 0, 0, 0, 0, 0);
12586         void* ret_ptr = untag_ptr(ret);
12587         CHECK_ACCESS(ret_ptr);
12588         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
12589         FREE(untag_ptr(ret));
12590         return ret_conv;
12591 }
12592 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
12593         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12594         int64_t starting_point_conv = starting_point;
12595         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 104, starting_point_conv, 0, 0, 0, 0, 0);
12596         void* ret_ptr = untag_ptr(ret);
12597         CHECK_ACCESS(ret_ptr);
12598         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
12599         FREE(untag_ptr(ret));
12600         return ret_conv;
12601 }
12602 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
12603         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12604         LDKNodeId starting_point_var = starting_point;
12605         uint64_t starting_point_ref = 0;
12606         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
12607         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
12608         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 105, starting_point_ref, 0, 0, 0, 0, 0);
12609         LDKNodeAnnouncement ret_conv;
12610         ret_conv.inner = untag_ptr(ret);
12611         ret_conv.is_owned = ptr_is_owned(ret);
12612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12613         return ret_conv;
12614 }
12615 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
12616         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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         LDKInit init_var = *init;
12620         uint64_t init_ref = 0;
12621         init_var = Init_clone(&init_var);
12622         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
12623         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
12624         jboolean inbound_conv = inbound;
12625         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 106, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
12626         void* ret_ptr = untag_ptr(ret);
12627         CHECK_ACCESS(ret_ptr);
12628         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
12629         FREE(untag_ptr(ret));
12630         return ret_conv;
12631 }
12632 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
12633         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12634         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12635         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12636         LDKReplyChannelRange msg_var = msg;
12637         uint64_t msg_ref = 0;
12638         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12639         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12640         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 107, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12641         void* ret_ptr = untag_ptr(ret);
12642         CHECK_ACCESS(ret_ptr);
12643         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12644         FREE(untag_ptr(ret));
12645         return ret_conv;
12646 }
12647 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
12648         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12649         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12650         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12651         LDKReplyShortChannelIdsEnd msg_var = msg;
12652         uint64_t msg_ref = 0;
12653         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12654         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12655         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 108, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12656         void* ret_ptr = untag_ptr(ret);
12657         CHECK_ACCESS(ret_ptr);
12658         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12659         FREE(untag_ptr(ret));
12660         return ret_conv;
12661 }
12662 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
12663         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12664         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12665         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12666         LDKQueryChannelRange msg_var = msg;
12667         uint64_t msg_ref = 0;
12668         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12669         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12670         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 109, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12671         void* ret_ptr = untag_ptr(ret);
12672         CHECK_ACCESS(ret_ptr);
12673         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12674         FREE(untag_ptr(ret));
12675         return ret_conv;
12676 }
12677 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
12678         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12679         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12680         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12681         LDKQueryShortChannelIds msg_var = msg;
12682         uint64_t msg_ref = 0;
12683         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
12684         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
12685         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 110, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0);
12686         void* ret_ptr = untag_ptr(ret);
12687         CHECK_ACCESS(ret_ptr);
12688         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
12689         FREE(untag_ptr(ret));
12690         return ret_conv;
12691 }
12692 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
12693         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12694         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 111, 0, 0, 0, 0, 0, 0);
12695 }
12696 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
12697         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12698         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, 0, 0, 0, 0, 0, 0);
12699         LDKNodeFeatures ret_conv;
12700         ret_conv.inner = untag_ptr(ret);
12701         ret_conv.is_owned = ptr_is_owned(ret);
12702         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12703         return ret_conv;
12704 }
12705 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
12706         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
12707         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
12708         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
12709         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
12710         LDKInitFeatures ret_conv;
12711         ret_conv.inner = untag_ptr(ret);
12712         ret_conv.is_owned = ptr_is_owned(ret);
12713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12714         return ret_conv;
12715 }
12716 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
12717         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
12718         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12719         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
12720 }
12721 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, JSValue MessageSendEventsProvider) {
12722         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
12723         atomic_init(&calls->refcnt, 1);
12724         calls->instance_ptr = o;
12725
12726         LDKRoutingMessageHandler ret = {
12727                 .this_arg = (void*) calls,
12728                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
12729                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
12730                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
12731                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
12732                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
12733                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
12734                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
12735                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
12736                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
12737                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
12738                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
12739                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
12740                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
12741                 .free = LDKRoutingMessageHandler_JCalls_free,
12742                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(MessageSendEventsProvider),
12743         };
12744         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
12745         return ret;
12746 }
12747 uint64_t  __attribute__((export_name("TS_LDKRoutingMessageHandler_new"))) TS_LDKRoutingMessageHandler_new(JSValue o, JSValue MessageSendEventsProvider) {
12748         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12749         *res_ptr = LDKRoutingMessageHandler_init(o, MessageSendEventsProvider);
12750         return tag_ptr(res_ptr, true);
12751 }
12752 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_node_announcement"))) TS_RoutingMessageHandler_handle_node_announcement(uint64_t this_arg, uint64_t msg) {
12753         void* this_arg_ptr = untag_ptr(this_arg);
12754         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12755         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12756         LDKNodeAnnouncement msg_conv;
12757         msg_conv.inner = untag_ptr(msg);
12758         msg_conv.is_owned = ptr_is_owned(msg);
12759         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12760         msg_conv.is_owned = false;
12761         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12762         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
12763         return tag_ptr(ret_conv, true);
12764 }
12765
12766 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_announcement"))) TS_RoutingMessageHandler_handle_channel_announcement(uint64_t this_arg, uint64_t msg) {
12767         void* this_arg_ptr = untag_ptr(this_arg);
12768         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12769         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12770         LDKChannelAnnouncement msg_conv;
12771         msg_conv.inner = untag_ptr(msg);
12772         msg_conv.is_owned = ptr_is_owned(msg);
12773         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12774         msg_conv.is_owned = false;
12775         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12776         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
12777         return tag_ptr(ret_conv, true);
12778 }
12779
12780 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_handle_channel_update"))) TS_RoutingMessageHandler_handle_channel_update(uint64_t this_arg, uint64_t msg) {
12781         void* this_arg_ptr = untag_ptr(this_arg);
12782         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12783         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12784         LDKChannelUpdate msg_conv;
12785         msg_conv.inner = untag_ptr(msg);
12786         msg_conv.is_owned = ptr_is_owned(msg);
12787         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12788         msg_conv.is_owned = false;
12789         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
12790         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
12791         return tag_ptr(ret_conv, true);
12792 }
12793
12794 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) {
12795         void* this_arg_ptr = untag_ptr(this_arg);
12796         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12797         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12798         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
12799         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
12800         uint64_t ret_ref = tag_ptr(ret_copy, true);
12801         return ret_ref;
12802 }
12803
12804 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) {
12805         void* this_arg_ptr = untag_ptr(this_arg);
12806         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12807         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12808         LDKNodeId starting_point_conv;
12809         starting_point_conv.inner = untag_ptr(starting_point);
12810         starting_point_conv.is_owned = ptr_is_owned(starting_point);
12811         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
12812         starting_point_conv = NodeId_clone(&starting_point_conv);
12813         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
12814         uint64_t ret_ref = 0;
12815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12817         return ret_ref;
12818 }
12819
12820 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) {
12821         void* this_arg_ptr = untag_ptr(this_arg);
12822         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12823         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12824         LDKPublicKey their_node_id_ref;
12825         CHECK(their_node_id->arr_len == 33);
12826         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12827         LDKInit init_conv;
12828         init_conv.inner = untag_ptr(init);
12829         init_conv.is_owned = ptr_is_owned(init);
12830         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
12831         init_conv.is_owned = false;
12832         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
12833         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
12834         return tag_ptr(ret_conv, true);
12835 }
12836
12837 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) {
12838         void* this_arg_ptr = untag_ptr(this_arg);
12839         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12840         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12841         LDKPublicKey their_node_id_ref;
12842         CHECK(their_node_id->arr_len == 33);
12843         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12844         LDKReplyChannelRange msg_conv;
12845         msg_conv.inner = untag_ptr(msg);
12846         msg_conv.is_owned = ptr_is_owned(msg);
12847         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12848         msg_conv = ReplyChannelRange_clone(&msg_conv);
12849         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12850         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12851         return tag_ptr(ret_conv, true);
12852 }
12853
12854 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) {
12855         void* this_arg_ptr = untag_ptr(this_arg);
12856         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12857         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12858         LDKPublicKey their_node_id_ref;
12859         CHECK(their_node_id->arr_len == 33);
12860         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12861         LDKReplyShortChannelIdsEnd msg_conv;
12862         msg_conv.inner = untag_ptr(msg);
12863         msg_conv.is_owned = ptr_is_owned(msg);
12864         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12865         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
12866         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12867         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12868         return tag_ptr(ret_conv, true);
12869 }
12870
12871 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) {
12872         void* this_arg_ptr = untag_ptr(this_arg);
12873         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12874         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12875         LDKPublicKey their_node_id_ref;
12876         CHECK(their_node_id->arr_len == 33);
12877         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12878         LDKQueryChannelRange msg_conv;
12879         msg_conv.inner = untag_ptr(msg);
12880         msg_conv.is_owned = ptr_is_owned(msg);
12881         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12882         msg_conv = QueryChannelRange_clone(&msg_conv);
12883         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12884         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12885         return tag_ptr(ret_conv, true);
12886 }
12887
12888 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) {
12889         void* this_arg_ptr = untag_ptr(this_arg);
12890         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12891         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12892         LDKPublicKey their_node_id_ref;
12893         CHECK(their_node_id->arr_len == 33);
12894         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12895         LDKQueryShortChannelIds msg_conv;
12896         msg_conv.inner = untag_ptr(msg);
12897         msg_conv.is_owned = ptr_is_owned(msg);
12898         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
12899         msg_conv = QueryShortChannelIds_clone(&msg_conv);
12900         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
12901         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
12902         return tag_ptr(ret_conv, true);
12903 }
12904
12905 jboolean  __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) {
12906         void* this_arg_ptr = untag_ptr(this_arg);
12907         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12908         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12909         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
12910         return ret_conv;
12911 }
12912
12913 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) {
12914         void* this_arg_ptr = untag_ptr(this_arg);
12915         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12916         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12917         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
12918         uint64_t ret_ref = 0;
12919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12921         return ret_ref;
12922 }
12923
12924 uint64_t  __attribute__((export_name("TS_RoutingMessageHandler_provided_init_features"))) TS_RoutingMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
12925         void* this_arg_ptr = untag_ptr(this_arg);
12926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12927         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
12928         LDKPublicKey their_node_id_ref;
12929         CHECK(their_node_id->arr_len == 33);
12930         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
12931         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
12932         uint64_t ret_ref = 0;
12933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12935         return ret_ref;
12936 }
12937
12938 typedef struct LDKOnionMessageProvider_JCalls {
12939         atomic_size_t refcnt;
12940         uint32_t instance_ptr;
12941 } LDKOnionMessageProvider_JCalls;
12942 static void LDKOnionMessageProvider_JCalls_free(void* this_arg) {
12943         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
12944         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
12945                 FREE(j_calls);
12946         }
12947 }
12948 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
12949         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg;
12950         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
12951         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
12952         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 114, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0);
12953         LDKOnionMessage ret_conv;
12954         ret_conv.inner = untag_ptr(ret);
12955         ret_conv.is_owned = ptr_is_owned(ret);
12956         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
12957         return ret_conv;
12958 }
12959 static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) {
12960         LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg;
12961         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
12962 }
12963 static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JSValue o) {
12964         LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls");
12965         atomic_init(&calls->refcnt, 1);
12966         calls->instance_ptr = o;
12967
12968         LDKOnionMessageProvider ret = {
12969                 .this_arg = (void*) calls,
12970                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall,
12971                 .free = LDKOnionMessageProvider_JCalls_free,
12972         };
12973         return ret;
12974 }
12975 uint64_t  __attribute__((export_name("TS_LDKOnionMessageProvider_new"))) TS_LDKOnionMessageProvider_new(JSValue o) {
12976         LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
12977         *res_ptr = LDKOnionMessageProvider_init(o);
12978         return tag_ptr(res_ptr, true);
12979 }
12980 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) {
12981         void* this_arg_ptr = untag_ptr(this_arg);
12982         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
12983         LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr;
12984         LDKPublicKey peer_node_id_ref;
12985         CHECK(peer_node_id->arr_len == 33);
12986         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
12987         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
12988         uint64_t ret_ref = 0;
12989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12991         return ret_ref;
12992 }
12993
12994 typedef struct LDKOnionMessageHandler_JCalls {
12995         atomic_size_t refcnt;
12996         uint32_t instance_ptr;
12997         LDKOnionMessageProvider_JCalls* OnionMessageProvider;
12998 } LDKOnionMessageHandler_JCalls;
12999 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
13000         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13001         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13002                 FREE(j_calls);
13003         }
13004 }
13005 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
13006         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13007         int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__);
13008         memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33);
13009         LDKOnionMessage msg_var = *msg;
13010         uint64_t msg_ref = 0;
13011         msg_var = OnionMessage_clone(&msg_var);
13012         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
13013         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
13014         js_invoke_function_ubuuuu(j_calls->instance_ptr, 115, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0);
13015 }
13016 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
13017         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13018         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13019         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13020         LDKInit init_var = *init;
13021         uint64_t init_ref = 0;
13022         init_var = Init_clone(&init_var);
13023         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
13024         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
13025         jboolean inbound_conv = inbound;
13026         uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 116, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0);
13027         void* ret_ptr = untag_ptr(ret);
13028         CHECK_ACCESS(ret_ptr);
13029         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
13030         FREE(untag_ptr(ret));
13031         return ret_conv;
13032 }
13033 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13034         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13035         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13036         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13037         js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13038 }
13039 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
13040         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13041         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 118, 0, 0, 0, 0, 0, 0);
13042         LDKNodeFeatures ret_conv;
13043         ret_conv.inner = untag_ptr(ret);
13044         ret_conv.is_owned = ptr_is_owned(ret);
13045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13046         return ret_conv;
13047 }
13048 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13049         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
13050         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13051         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13052         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 119, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13053         LDKInitFeatures ret_conv;
13054         ret_conv.inner = untag_ptr(ret);
13055         ret_conv.is_owned = ptr_is_owned(ret);
13056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13057         return ret_conv;
13058 }
13059 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
13060         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
13061         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13062         atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release);
13063 }
13064 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JSValue o, JSValue OnionMessageProvider) {
13065         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
13066         atomic_init(&calls->refcnt, 1);
13067         calls->instance_ptr = o;
13068
13069         LDKOnionMessageHandler ret = {
13070                 .this_arg = (void*) calls,
13071                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
13072                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
13073                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
13074                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
13075                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
13076                 .free = LDKOnionMessageHandler_JCalls_free,
13077                 .OnionMessageProvider = LDKOnionMessageProvider_init(OnionMessageProvider),
13078         };
13079         calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg;
13080         return ret;
13081 }
13082 uint64_t  __attribute__((export_name("TS_LDKOnionMessageHandler_new"))) TS_LDKOnionMessageHandler_new(JSValue o, JSValue OnionMessageProvider) {
13083         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
13084         *res_ptr = LDKOnionMessageHandler_init(o, OnionMessageProvider);
13085         return tag_ptr(res_ptr, true);
13086 }
13087 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) {
13088         void* this_arg_ptr = untag_ptr(this_arg);
13089         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13090         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13091         LDKPublicKey peer_node_id_ref;
13092         CHECK(peer_node_id->arr_len == 33);
13093         memcpy(peer_node_id_ref.compressed_form, peer_node_id->elems, 33); FREE(peer_node_id);
13094         LDKOnionMessage msg_conv;
13095         msg_conv.inner = untag_ptr(msg);
13096         msg_conv.is_owned = ptr_is_owned(msg);
13097         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
13098         msg_conv.is_owned = false;
13099         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
13100 }
13101
13102 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) {
13103         void* this_arg_ptr = untag_ptr(this_arg);
13104         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13105         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13106         LDKPublicKey their_node_id_ref;
13107         CHECK(their_node_id->arr_len == 33);
13108         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13109         LDKInit init_conv;
13110         init_conv.inner = untag_ptr(init);
13111         init_conv.is_owned = ptr_is_owned(init);
13112         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
13113         init_conv.is_owned = false;
13114         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
13115         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
13116         return tag_ptr(ret_conv, true);
13117 }
13118
13119 void  __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) {
13120         void* this_arg_ptr = untag_ptr(this_arg);
13121         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13122         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13123         LDKPublicKey their_node_id_ref;
13124         CHECK(their_node_id->arr_len == 33);
13125         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13126         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
13127 }
13128
13129 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) {
13130         void* this_arg_ptr = untag_ptr(this_arg);
13131         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13132         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13133         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13134         uint64_t ret_ref = 0;
13135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13137         return ret_ref;
13138 }
13139
13140 uint64_t  __attribute__((export_name("TS_OnionMessageHandler_provided_init_features"))) TS_OnionMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13141         void* this_arg_ptr = untag_ptr(this_arg);
13142         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13143         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
13144         LDKPublicKey their_node_id_ref;
13145         CHECK(their_node_id->arr_len == 33);
13146         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13147         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13148         uint64_t ret_ref = 0;
13149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13151         return ret_ref;
13152 }
13153
13154 typedef struct LDKCustomMessageReader_JCalls {
13155         atomic_size_t refcnt;
13156         uint32_t instance_ptr;
13157 } LDKCustomMessageReader_JCalls;
13158 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
13159         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13160         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13161                 FREE(j_calls);
13162         }
13163 }
13164 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
13165         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
13166         int16_t message_type_conv = message_type;
13167         LDKu8slice buffer_var = buffer;
13168         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
13169         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
13170         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
13171         void* ret_ptr = untag_ptr(ret);
13172         CHECK_ACCESS(ret_ptr);
13173         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
13174         FREE(untag_ptr(ret));
13175         return ret_conv;
13176 }
13177 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
13178         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
13179         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13180 }
13181 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JSValue o) {
13182         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
13183         atomic_init(&calls->refcnt, 1);
13184         calls->instance_ptr = o;
13185
13186         LDKCustomMessageReader ret = {
13187                 .this_arg = (void*) calls,
13188                 .read = read_LDKCustomMessageReader_jcall,
13189                 .free = LDKCustomMessageReader_JCalls_free,
13190         };
13191         return ret;
13192 }
13193 uint64_t  __attribute__((export_name("TS_LDKCustomMessageReader_new"))) TS_LDKCustomMessageReader_new(JSValue o) {
13194         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
13195         *res_ptr = LDKCustomMessageReader_init(o);
13196         return tag_ptr(res_ptr, true);
13197 }
13198 uint64_t  __attribute__((export_name("TS_CustomMessageReader_read"))) TS_CustomMessageReader_read(uint64_t this_arg, int16_t message_type, int8_tArray buffer) {
13199         void* this_arg_ptr = untag_ptr(this_arg);
13200         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13201         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
13202         LDKu8slice buffer_ref;
13203         buffer_ref.datalen = buffer->arr_len;
13204         buffer_ref.data = buffer->elems;
13205         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
13206         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
13207         FREE(buffer);
13208         return tag_ptr(ret_conv, true);
13209 }
13210
13211 typedef struct LDKCustomMessageHandler_JCalls {
13212         atomic_size_t refcnt;
13213         uint32_t instance_ptr;
13214         LDKCustomMessageReader_JCalls* CustomMessageReader;
13215 } LDKCustomMessageHandler_JCalls;
13216 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
13217         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13218         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13219                 FREE(j_calls);
13220         }
13221 }
13222 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
13223         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13224         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
13225         *msg_ret = msg;
13226         int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__);
13227         memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33);
13228         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 121, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0);
13229         void* ret_ptr = untag_ptr(ret);
13230         CHECK_ACCESS(ret_ptr);
13231         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
13232         FREE(untag_ptr(ret));
13233         return ret_conv;
13234 }
13235 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
13236         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13237         uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 122, 0, 0, 0, 0, 0, 0);
13238         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
13239         ret_constr.datalen = ret->arr_len;
13240         if (ret_constr.datalen > 0)
13241                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
13242         else
13243                 ret_constr.data = NULL;
13244         uint64_t* ret_vals = ret->elems;
13245         for (size_t z = 0; z < ret_constr.datalen; z++) {
13246                 uint64_t ret_conv_25 = ret_vals[z];
13247                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
13248                 CHECK_ACCESS(ret_conv_25_ptr);
13249                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
13250                 FREE(untag_ptr(ret_conv_25));
13251                 ret_constr.data[z] = ret_conv_25_conv;
13252         }
13253         FREE(ret);
13254         return ret_constr;
13255 }
13256 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
13257         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13258         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 123, 0, 0, 0, 0, 0, 0);
13259         LDKNodeFeatures ret_conv;
13260         ret_conv.inner = untag_ptr(ret);
13261         ret_conv.is_owned = ptr_is_owned(ret);
13262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13263         return ret_conv;
13264 }
13265 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
13266         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
13267         int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__);
13268         memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33);
13269         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 124, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0);
13270         LDKInitFeatures ret_conv;
13271         ret_conv.inner = untag_ptr(ret);
13272         ret_conv.is_owned = ptr_is_owned(ret);
13273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
13274         return ret_conv;
13275 }
13276 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
13277         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
13278         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13279         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
13280 }
13281 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JSValue o, JSValue CustomMessageReader) {
13282         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
13283         atomic_init(&calls->refcnt, 1);
13284         calls->instance_ptr = o;
13285
13286         LDKCustomMessageHandler ret = {
13287                 .this_arg = (void*) calls,
13288                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
13289                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
13290                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
13291                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
13292                 .free = LDKCustomMessageHandler_JCalls_free,
13293                 .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
13294         };
13295         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
13296         return ret;
13297 }
13298 uint64_t  __attribute__((export_name("TS_LDKCustomMessageHandler_new"))) TS_LDKCustomMessageHandler_new(JSValue o, JSValue CustomMessageReader) {
13299         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
13300         *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
13301         return tag_ptr(res_ptr, true);
13302 }
13303 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) {
13304         void* this_arg_ptr = untag_ptr(this_arg);
13305         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13306         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13307         void* msg_ptr = untag_ptr(msg);
13308         CHECK_ACCESS(msg_ptr);
13309         LDKType msg_conv = *(LDKType*)(msg_ptr);
13310         if (msg_conv.free == LDKType_JCalls_free) {
13311                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13312                 LDKType_JCalls_cloned(&msg_conv);
13313         }
13314         LDKPublicKey sender_node_id_ref;
13315         CHECK(sender_node_id->arr_len == 33);
13316         memcpy(sender_node_id_ref.compressed_form, sender_node_id->elems, 33); FREE(sender_node_id);
13317         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
13318         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
13319         return tag_ptr(ret_conv, true);
13320 }
13321
13322 uint64_tArray  __attribute__((export_name("TS_CustomMessageHandler_get_and_clear_pending_msg"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint64_t this_arg) {
13323         void* this_arg_ptr = untag_ptr(this_arg);
13324         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13325         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13326         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
13327         uint64_tArray ret_arr = NULL;
13328         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
13329         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
13330         for (size_t z = 0; z < ret_var.datalen; z++) {
13331                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
13332                 *ret_conv_25_conv = ret_var.data[z];
13333                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
13334         }
13335         
13336         FREE(ret_var.data);
13337         return ret_arr;
13338 }
13339
13340 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_node_features"))) TS_CustomMessageHandler_provided_node_features(uint64_t this_arg) {
13341         void* this_arg_ptr = untag_ptr(this_arg);
13342         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13343         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13344         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
13345         uint64_t ret_ref = 0;
13346         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13347         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13348         return ret_ref;
13349 }
13350
13351 uint64_t  __attribute__((export_name("TS_CustomMessageHandler_provided_init_features"))) TS_CustomMessageHandler_provided_init_features(uint64_t this_arg, int8_tArray their_node_id) {
13352         void* this_arg_ptr = untag_ptr(this_arg);
13353         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13354         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
13355         LDKPublicKey their_node_id_ref;
13356         CHECK(their_node_id->arr_len == 33);
13357         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
13358         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
13359         uint64_t ret_ref = 0;
13360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13362         return ret_ref;
13363 }
13364
13365 typedef struct LDKOffersMessageHandler_JCalls {
13366         atomic_size_t refcnt;
13367         uint32_t instance_ptr;
13368 } LDKOffersMessageHandler_JCalls;
13369 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
13370         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13371         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13372                 FREE(j_calls);
13373         }
13374 }
13375 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
13376         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
13377         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
13378         *message_copy = message;
13379         uint64_t message_ref = tag_ptr(message_copy, true);
13380         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 125, message_ref, 0, 0, 0, 0, 0);
13381         void* ret_ptr = untag_ptr(ret);
13382         CHECK_ACCESS(ret_ptr);
13383         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
13384         FREE(untag_ptr(ret));
13385         return ret_conv;
13386 }
13387 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
13388         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
13389         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13390 }
13391 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JSValue o) {
13392         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
13393         atomic_init(&calls->refcnt, 1);
13394         calls->instance_ptr = o;
13395
13396         LDKOffersMessageHandler ret = {
13397                 .this_arg = (void*) calls,
13398                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
13399                 .free = LDKOffersMessageHandler_JCalls_free,
13400         };
13401         return ret;
13402 }
13403 uint64_t  __attribute__((export_name("TS_LDKOffersMessageHandler_new"))) TS_LDKOffersMessageHandler_new(JSValue o) {
13404         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
13405         *res_ptr = LDKOffersMessageHandler_init(o);
13406         return tag_ptr(res_ptr, true);
13407 }
13408 uint64_t  __attribute__((export_name("TS_OffersMessageHandler_handle_message"))) TS_OffersMessageHandler_handle_message(uint64_t this_arg, uint64_t message) {
13409         void* this_arg_ptr = untag_ptr(this_arg);
13410         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13411         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
13412         void* message_ptr = untag_ptr(message);
13413         CHECK_ACCESS(message_ptr);
13414         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
13415         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
13416         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
13417         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
13418         uint64_t ret_ref = tag_ptr(ret_copy, true);
13419         return ret_ref;
13420 }
13421
13422 typedef struct LDKCustomOnionMessageHandler_JCalls {
13423         atomic_size_t refcnt;
13424         uint32_t instance_ptr;
13425 } LDKCustomOnionMessageHandler_JCalls;
13426 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
13427         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
13428         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13429                 FREE(j_calls);
13430         }
13431 }
13432 LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) {
13433         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
13434         LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
13435         *msg_ret = msg;
13436         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 126, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0);
13437         void* ret_ptr = untag_ptr(ret);
13438         CHECK_ACCESS(ret_ptr);
13439         LDKCOption_CustomOnionMessageContentsZ ret_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(ret_ptr);
13440         FREE(untag_ptr(ret));
13441         return ret_conv;
13442 }
13443 LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
13444         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
13445         int64_t message_type_conv = message_type;
13446         LDKu8slice buffer_var = buffer;
13447         int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__);
13448         memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen);
13449         uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 127, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0);
13450         void* ret_ptr = untag_ptr(ret);
13451         CHECK_ACCESS(ret_ptr);
13452         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr);
13453         FREE(untag_ptr(ret));
13454         return ret_conv;
13455 }
13456 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
13457         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
13458         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13459 }
13460 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JSValue o) {
13461         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
13462         atomic_init(&calls->refcnt, 1);
13463         calls->instance_ptr = o;
13464
13465         LDKCustomOnionMessageHandler ret = {
13466                 .this_arg = (void*) calls,
13467                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
13468                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
13469                 .free = LDKCustomOnionMessageHandler_JCalls_free,
13470         };
13471         return ret;
13472 }
13473 uint64_t  __attribute__((export_name("TS_LDKCustomOnionMessageHandler_new"))) TS_LDKCustomOnionMessageHandler_new(JSValue o) {
13474         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
13475         *res_ptr = LDKCustomOnionMessageHandler_init(o);
13476         return tag_ptr(res_ptr, true);
13477 }
13478 uint64_t  __attribute__((export_name("TS_CustomOnionMessageHandler_handle_custom_message"))) TS_CustomOnionMessageHandler_handle_custom_message(uint64_t this_arg, uint64_t msg) {
13479         void* this_arg_ptr = untag_ptr(this_arg);
13480         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13481         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
13482         void* msg_ptr = untag_ptr(msg);
13483         CHECK_ACCESS(msg_ptr);
13484         LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr);
13485         if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
13486                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13487                 LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv);
13488         }
13489         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
13490         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
13491         uint64_t ret_ref = tag_ptr(ret_copy, true);
13492         return ret_ref;
13493 }
13494
13495 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) {
13496         void* this_arg_ptr = untag_ptr(this_arg);
13497         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13498         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
13499         LDKu8slice buffer_ref;
13500         buffer_ref.datalen = buffer->arr_len;
13501         buffer_ref.data = buffer->elems;
13502         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
13503         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
13504         FREE(buffer);
13505         return tag_ptr(ret_conv, true);
13506 }
13507
13508 typedef struct LDKSocketDescriptor_JCalls {
13509         atomic_size_t refcnt;
13510         uint32_t instance_ptr;
13511 } LDKSocketDescriptor_JCalls;
13512 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
13513         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13514         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13515                 FREE(j_calls);
13516         }
13517 }
13518 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
13519         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13520         LDKu8slice data_var = data;
13521         int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__);
13522         memcpy(data_arr->elems, data_var.data, data_var.datalen);
13523         jboolean resume_read_conv = resume_read;
13524         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 128, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0);
13525 }
13526 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
13527         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13528         js_invoke_function_uuuuuu(j_calls->instance_ptr, 129, 0, 0, 0, 0, 0, 0);
13529 }
13530 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
13531         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13532         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13533         *other_arg_clone = SocketDescriptor_clone(other_arg);
13534         return js_invoke_function_buuuuu(j_calls->instance_ptr, 130, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0);
13535 }
13536 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
13537         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
13538         return js_invoke_function_uuuuuu(j_calls->instance_ptr, 131, 0, 0, 0, 0, 0, 0);
13539 }
13540 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
13541         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
13542         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13543 }
13544 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JSValue o) {
13545         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
13546         atomic_init(&calls->refcnt, 1);
13547         calls->instance_ptr = o;
13548
13549         LDKSocketDescriptor ret = {
13550                 .this_arg = (void*) calls,
13551                 .send_data = send_data_LDKSocketDescriptor_jcall,
13552                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
13553                 .eq = eq_LDKSocketDescriptor_jcall,
13554                 .hash = hash_LDKSocketDescriptor_jcall,
13555                 .cloned = LDKSocketDescriptor_JCalls_cloned,
13556                 .free = LDKSocketDescriptor_JCalls_free,
13557         };
13558         return ret;
13559 }
13560 uint64_t  __attribute__((export_name("TS_LDKSocketDescriptor_new"))) TS_LDKSocketDescriptor_new(JSValue o) {
13561         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
13562         *res_ptr = LDKSocketDescriptor_init(o);
13563         return tag_ptr(res_ptr, true);
13564 }
13565 uint32_t  __attribute__((export_name("TS_SocketDescriptor_send_data"))) TS_SocketDescriptor_send_data(uint64_t this_arg, int8_tArray data, jboolean resume_read) {
13566         void* this_arg_ptr = untag_ptr(this_arg);
13567         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13568         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13569         LDKu8slice data_ref;
13570         data_ref.datalen = data->arr_len;
13571         data_ref.data = data->elems;
13572         uint32_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
13573         FREE(data);
13574         return ret_conv;
13575 }
13576
13577 void  __attribute__((export_name("TS_SocketDescriptor_disconnect_socket"))) TS_SocketDescriptor_disconnect_socket(uint64_t this_arg) {
13578         void* this_arg_ptr = untag_ptr(this_arg);
13579         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13580         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13581         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
13582 }
13583
13584 int64_t  __attribute__((export_name("TS_SocketDescriptor_hash"))) TS_SocketDescriptor_hash(uint64_t this_arg) {
13585         void* this_arg_ptr = untag_ptr(this_arg);
13586         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13587         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
13588         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
13589         return ret_conv;
13590 }
13591
13592 uint32_t __attribute__((export_name("TS_LDKEffectiveCapacity_ty_from_ptr"))) TS_LDKEffectiveCapacity_ty_from_ptr(uint64_t ptr) {
13593         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13594         switch(obj->tag) {
13595                 case LDKEffectiveCapacity_ExactLiquidity: return 0;
13596                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: return 1;
13597                 case LDKEffectiveCapacity_Total: return 2;
13598                 case LDKEffectiveCapacity_Infinite: return 3;
13599                 case LDKEffectiveCapacity_HintMaxHTLC: return 4;
13600                 case LDKEffectiveCapacity_Unknown: return 5;
13601                 default: abort();
13602         }
13603 }
13604 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat"))) TS_LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(uint64_t ptr) {
13605         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13606         assert(obj->tag == LDKEffectiveCapacity_ExactLiquidity);
13607                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
13608         return liquidity_msat_conv;
13609 }
13610 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(uint64_t ptr) {
13611         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13612         assert(obj->tag == LDKEffectiveCapacity_AdvertisedMaxHTLC);
13613                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
13614         return amount_msat_conv;
13615 }
13616 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_msat"))) TS_LDKEffectiveCapacity_Total_get_capacity_msat(uint64_t ptr) {
13617         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13618         assert(obj->tag == LDKEffectiveCapacity_Total);
13619                         int64_t capacity_msat_conv = obj->total.capacity_msat;
13620         return capacity_msat_conv;
13621 }
13622 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) {
13623         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13624         assert(obj->tag == LDKEffectiveCapacity_Total);
13625                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
13626         return htlc_maximum_msat_conv;
13627 }
13628 int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat"))) TS_LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(uint64_t ptr) {
13629         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
13630         assert(obj->tag == LDKEffectiveCapacity_HintMaxHTLC);
13631                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
13632         return amount_msat_conv;
13633 }
13634 uint32_t __attribute__((export_name("TS_LDKPayee_ty_from_ptr"))) TS_LDKPayee_ty_from_ptr(uint64_t ptr) {
13635         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13636         switch(obj->tag) {
13637                 case LDKPayee_Blinded: return 0;
13638                 case LDKPayee_Clear: return 1;
13639                 default: abort();
13640         }
13641 }
13642 uint64_tArray __attribute__((export_name("TS_LDKPayee_Blinded_get_route_hints"))) TS_LDKPayee_Blinded_get_route_hints(uint64_t ptr) {
13643         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13644         assert(obj->tag == LDKPayee_Blinded);
13645                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
13646                         uint64_tArray route_hints_arr = NULL;
13647                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
13648                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
13649                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
13650                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
13651                                 *route_hints_conv_37_conv = route_hints_var.data[l];
13652                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
13653                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
13654                         }
13655                         
13656         return route_hints_arr;
13657 }
13658 uint64_t __attribute__((export_name("TS_LDKPayee_Blinded_get_features"))) TS_LDKPayee_Blinded_get_features(uint64_t ptr) {
13659         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13660         assert(obj->tag == LDKPayee_Blinded);
13661                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
13662                         uint64_t features_ref = 0;
13663                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
13664                         features_ref = tag_ptr(features_var.inner, false);
13665         return features_ref;
13666 }
13667 int8_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_node_id"))) TS_LDKPayee_Clear_get_node_id(uint64_t ptr) {
13668         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13669         assert(obj->tag == LDKPayee_Clear);
13670                         int8_tArray node_id_arr = init_int8_tArray(33, __LINE__);
13671                         memcpy(node_id_arr->elems, obj->clear.node_id.compressed_form, 33);
13672         return node_id_arr;
13673 }
13674 uint64_tArray __attribute__((export_name("TS_LDKPayee_Clear_get_route_hints"))) TS_LDKPayee_Clear_get_route_hints(uint64_t ptr) {
13675         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13676         assert(obj->tag == LDKPayee_Clear);
13677                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
13678                         uint64_tArray route_hints_arr = NULL;
13679                         route_hints_arr = init_uint64_tArray(route_hints_var.datalen, __LINE__);
13680                         uint64_t *route_hints_arr_ptr = (uint64_t*)(((uint8_t*)route_hints_arr) + 8);
13681                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
13682                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
13683                                 uint64_t route_hints_conv_11_ref = 0;
13684                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
13685                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
13686                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
13687                         }
13688                         
13689         return route_hints_arr;
13690 }
13691 uint64_t __attribute__((export_name("TS_LDKPayee_Clear_get_features"))) TS_LDKPayee_Clear_get_features(uint64_t ptr) {
13692         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13693         assert(obj->tag == LDKPayee_Clear);
13694                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
13695                         uint64_t features_ref = 0;
13696                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
13697                         features_ref = tag_ptr(features_var.inner, false);
13698         return features_ref;
13699 }
13700 int32_t __attribute__((export_name("TS_LDKPayee_Clear_get_final_cltv_expiry_delta"))) TS_LDKPayee_Clear_get_final_cltv_expiry_delta(uint64_t ptr) {
13701         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
13702         assert(obj->tag == LDKPayee_Clear);
13703                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
13704         return final_cltv_expiry_delta_conv;
13705 }
13706 uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) {
13707         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
13708         switch(obj->tag) {
13709                 case LDKDestination_Node: return 0;
13710                 case LDKDestination_BlindedPath: return 1;
13711                 default: abort();
13712         }
13713 }
13714 int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) {
13715         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
13716         assert(obj->tag == LDKDestination_Node);
13717                         int8_tArray node_arr = init_int8_tArray(33, __LINE__);
13718                         memcpy(node_arr->elems, obj->node.compressed_form, 33);
13719         return node_arr;
13720 }
13721 uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) {
13722         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
13723         assert(obj->tag == LDKDestination_BlindedPath);
13724                         LDKBlindedPath blinded_path_var = obj->blinded_path;
13725                         uint64_t blinded_path_ref = 0;
13726                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
13727                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
13728         return blinded_path_ref;
13729 }
13730 typedef struct LDKMessageRouter_JCalls {
13731         atomic_size_t refcnt;
13732         uint32_t instance_ptr;
13733 } LDKMessageRouter_JCalls;
13734 static void LDKMessageRouter_JCalls_free(void* this_arg) {
13735         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
13736         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13737                 FREE(j_calls);
13738         }
13739 }
13740 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
13741         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
13742         int8_tArray sender_arr = init_int8_tArray(33, __LINE__);
13743         memcpy(sender_arr->elems, sender.compressed_form, 33);
13744         LDKCVec_PublicKeyZ peers_var = peers;
13745         ptrArray peers_arr = NULL;
13746         peers_arr = init_ptrArray(peers_var.datalen, __LINE__);
13747         int8_tArray *peers_arr_ptr = (int8_tArray*)(((uint8_t*)peers_arr) + 8);
13748         for (size_t m = 0; m < peers_var.datalen; m++) {
13749                 int8_tArray peers_conv_12_arr = init_int8_tArray(33, __LINE__);
13750                 memcpy(peers_conv_12_arr->elems, peers_var.data[m].compressed_form, 33);
13751                 peers_arr_ptr[m] = peers_conv_12_arr;
13752         }
13753         
13754         FREE(peers_var.data);
13755         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
13756         *destination_copy = destination;
13757         uint64_t destination_ref = tag_ptr(destination_copy, true);
13758         uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 132, (uint32_t)sender_arr, (uint32_t)peers_arr, destination_ref, 0, 0, 0);
13759         void* ret_ptr = untag_ptr(ret);
13760         CHECK_ACCESS(ret_ptr);
13761         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
13762         FREE(untag_ptr(ret));
13763         return ret_conv;
13764 }
13765 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
13766         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
13767         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13768 }
13769 static inline LDKMessageRouter LDKMessageRouter_init (JSValue o) {
13770         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
13771         atomic_init(&calls->refcnt, 1);
13772         calls->instance_ptr = o;
13773
13774         LDKMessageRouter ret = {
13775                 .this_arg = (void*) calls,
13776                 .find_path = find_path_LDKMessageRouter_jcall,
13777                 .free = LDKMessageRouter_JCalls_free,
13778         };
13779         return ret;
13780 }
13781 uint64_t  __attribute__((export_name("TS_LDKMessageRouter_new"))) TS_LDKMessageRouter_new(JSValue o) {
13782         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
13783         *res_ptr = LDKMessageRouter_init(o);
13784         return tag_ptr(res_ptr, true);
13785 }
13786 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) {
13787         void* this_arg_ptr = untag_ptr(this_arg);
13788         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13789         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
13790         LDKPublicKey sender_ref;
13791         CHECK(sender->arr_len == 33);
13792         memcpy(sender_ref.compressed_form, sender->elems, 33); FREE(sender);
13793         LDKCVec_PublicKeyZ peers_constr;
13794         peers_constr.datalen = peers->arr_len;
13795         if (peers_constr.datalen > 0)
13796                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
13797         else
13798                 peers_constr.data = NULL;
13799         int8_tArray* peers_vals = (void*) peers->elems;
13800         for (size_t m = 0; m < peers_constr.datalen; m++) {
13801                 int8_tArray peers_conv_12 = peers_vals[m];
13802                 LDKPublicKey peers_conv_12_ref;
13803                 CHECK(peers_conv_12->arr_len == 33);
13804                 memcpy(peers_conv_12_ref.compressed_form, peers_conv_12->elems, 33); FREE(peers_conv_12);
13805                 peers_constr.data[m] = peers_conv_12_ref;
13806         }
13807         FREE(peers);
13808         void* destination_ptr = untag_ptr(destination);
13809         CHECK_ACCESS(destination_ptr);
13810         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
13811         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
13812         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
13813         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
13814         return tag_ptr(ret_conv, true);
13815 }
13816
13817 uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) {
13818         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
13819         switch(obj->tag) {
13820                 case LDKOnionMessageContents_Offers: return 0;
13821                 case LDKOnionMessageContents_Custom: return 1;
13822                 default: abort();
13823         }
13824 }
13825 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Offers_get_offers"))) TS_LDKOnionMessageContents_Offers_get_offers(uint64_t ptr) {
13826         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
13827         assert(obj->tag == LDKOnionMessageContents_Offers);
13828                         uint64_t offers_ref = tag_ptr(&obj->offers, false);
13829         return offers_ref;
13830 }
13831 uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) {
13832         LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr);
13833         assert(obj->tag == LDKOnionMessageContents_Custom);
13834                         LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
13835                         *custom_ret = CustomOnionMessageContents_clone(&obj->custom);
13836         return tag_ptr(custom_ret, true);
13837 }
13838 typedef struct LDKCoinSelectionSource_JCalls {
13839         atomic_size_t refcnt;
13840         uint32_t instance_ptr;
13841 } LDKCoinSelectionSource_JCalls;
13842 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
13843         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
13844         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13845                 FREE(j_calls);
13846         }
13847 }
13848 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) {
13849         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
13850         int8_tArray claim_id_arr = init_int8_tArray(32, __LINE__);
13851         memcpy(claim_id_arr->elems, claim_id.data, 32);
13852         LDKCVec_InputZ must_spend_var = must_spend;
13853         uint64_tArray must_spend_arr = NULL;
13854         must_spend_arr = init_uint64_tArray(must_spend_var.datalen, __LINE__);
13855         uint64_t *must_spend_arr_ptr = (uint64_t*)(((uint8_t*)must_spend_arr) + 8);
13856         for (size_t h = 0; h < must_spend_var.datalen; h++) {
13857                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
13858                 uint64_t must_spend_conv_7_ref = 0;
13859                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
13860                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
13861                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
13862         }
13863         
13864         FREE(must_spend_var.data);
13865         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
13866         uint64_tArray must_pay_to_arr = NULL;
13867         must_pay_to_arr = init_uint64_tArray(must_pay_to_var.datalen, __LINE__);
13868         uint64_t *must_pay_to_arr_ptr = (uint64_t*)(((uint8_t*)must_pay_to_arr) + 8);
13869         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
13870                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
13871                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
13872                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
13873         }
13874         
13875         FREE(must_pay_to_var.data);
13876         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
13877         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 133, (uint32_t)claim_id_arr, (uint32_t)must_spend_arr, (uint32_t)must_pay_to_arr, target_feerate_sat_per_1000_weight_conv, 0, 0);
13878         void* ret_ptr = untag_ptr(ret);
13879         CHECK_ACCESS(ret_ptr);
13880         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
13881         FREE(untag_ptr(ret));
13882         return ret_conv;
13883 }
13884 LDKCResult_TransactionNoneZ sign_tx_LDKCoinSelectionSource_jcall(const void* this_arg, LDKTransaction tx) {
13885         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
13886         LDKTransaction tx_var = tx;
13887         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
13888         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
13889         Transaction_free(tx_var);
13890         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 134, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
13891         void* ret_ptr = untag_ptr(ret);
13892         CHECK_ACCESS(ret_ptr);
13893         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
13894         FREE(untag_ptr(ret));
13895         return ret_conv;
13896 }
13897 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
13898         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
13899         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
13900 }
13901 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JSValue o) {
13902         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
13903         atomic_init(&calls->refcnt, 1);
13904         calls->instance_ptr = o;
13905
13906         LDKCoinSelectionSource ret = {
13907                 .this_arg = (void*) calls,
13908                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
13909                 .sign_tx = sign_tx_LDKCoinSelectionSource_jcall,
13910                 .free = LDKCoinSelectionSource_JCalls_free,
13911         };
13912         return ret;
13913 }
13914 uint64_t  __attribute__((export_name("TS_LDKCoinSelectionSource_new"))) TS_LDKCoinSelectionSource_new(JSValue o) {
13915         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
13916         *res_ptr = LDKCoinSelectionSource_init(o);
13917         return tag_ptr(res_ptr, true);
13918 }
13919 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) {
13920         void* this_arg_ptr = untag_ptr(this_arg);
13921         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13922         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
13923         LDKThirtyTwoBytes claim_id_ref;
13924         CHECK(claim_id->arr_len == 32);
13925         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
13926         LDKCVec_InputZ must_spend_constr;
13927         must_spend_constr.datalen = must_spend->arr_len;
13928         if (must_spend_constr.datalen > 0)
13929                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
13930         else
13931                 must_spend_constr.data = NULL;
13932         uint64_t* must_spend_vals = must_spend->elems;
13933         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
13934                 uint64_t must_spend_conv_7 = must_spend_vals[h];
13935                 LDKInput must_spend_conv_7_conv;
13936                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
13937                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
13938                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
13939                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
13940                 must_spend_constr.data[h] = must_spend_conv_7_conv;
13941         }
13942         FREE(must_spend);
13943         LDKCVec_TxOutZ must_pay_to_constr;
13944         must_pay_to_constr.datalen = must_pay_to->arr_len;
13945         if (must_pay_to_constr.datalen > 0)
13946                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
13947         else
13948                 must_pay_to_constr.data = NULL;
13949         uint64_t* must_pay_to_vals = must_pay_to->elems;
13950         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
13951                 uint64_t must_pay_to_conv_7 = must_pay_to_vals[h];
13952                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
13953                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
13954                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
13955                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
13956                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
13957         }
13958         FREE(must_pay_to);
13959         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
13960         *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);
13961         return tag_ptr(ret_conv, true);
13962 }
13963
13964 uint64_t  __attribute__((export_name("TS_CoinSelectionSource_sign_tx"))) TS_CoinSelectionSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
13965         void* this_arg_ptr = untag_ptr(this_arg);
13966         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
13967         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
13968         LDKTransaction tx_ref;
13969         tx_ref.datalen = tx->arr_len;
13970         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
13971         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
13972         tx_ref.data_is_owned = true;
13973         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
13974         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
13975         return tag_ptr(ret_conv, true);
13976 }
13977
13978 typedef struct LDKWalletSource_JCalls {
13979         atomic_size_t refcnt;
13980         uint32_t instance_ptr;
13981 } LDKWalletSource_JCalls;
13982 static void LDKWalletSource_JCalls_free(void* this_arg) {
13983         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
13984         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
13985                 FREE(j_calls);
13986         }
13987 }
13988 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
13989         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
13990         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 135, 0, 0, 0, 0, 0, 0);
13991         void* ret_ptr = untag_ptr(ret);
13992         CHECK_ACCESS(ret_ptr);
13993         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
13994         FREE(untag_ptr(ret));
13995         return ret_conv;
13996 }
13997 LDKCResult_ScriptNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
13998         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
13999         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 136, 0, 0, 0, 0, 0, 0);
14000         void* ret_ptr = untag_ptr(ret);
14001         CHECK_ACCESS(ret_ptr);
14002         LDKCResult_ScriptNoneZ ret_conv = *(LDKCResult_ScriptNoneZ*)(ret_ptr);
14003         FREE(untag_ptr(ret));
14004         return ret_conv;
14005 }
14006 LDKCResult_TransactionNoneZ sign_tx_LDKWalletSource_jcall(const void* this_arg, LDKTransaction tx) {
14007         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
14008         LDKTransaction tx_var = tx;
14009         int8_tArray tx_arr = init_int8_tArray(tx_var.datalen, __LINE__);
14010         memcpy(tx_arr->elems, tx_var.data, tx_var.datalen);
14011         Transaction_free(tx_var);
14012         uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 137, (uint32_t)tx_arr, 0, 0, 0, 0, 0);
14013         void* ret_ptr = untag_ptr(ret);
14014         CHECK_ACCESS(ret_ptr);
14015         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
14016         FREE(untag_ptr(ret));
14017         return ret_conv;
14018 }
14019 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
14020         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
14021         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
14022 }
14023 static inline LDKWalletSource LDKWalletSource_init (JSValue o) {
14024         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
14025         atomic_init(&calls->refcnt, 1);
14026         calls->instance_ptr = o;
14027
14028         LDKWalletSource ret = {
14029                 .this_arg = (void*) calls,
14030                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
14031                 .get_change_script = get_change_script_LDKWalletSource_jcall,
14032                 .sign_tx = sign_tx_LDKWalletSource_jcall,
14033                 .free = LDKWalletSource_JCalls_free,
14034         };
14035         return ret;
14036 }
14037 uint64_t  __attribute__((export_name("TS_LDKWalletSource_new"))) TS_LDKWalletSource_new(JSValue o) {
14038         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
14039         *res_ptr = LDKWalletSource_init(o);
14040         return tag_ptr(res_ptr, true);
14041 }
14042 uint64_t  __attribute__((export_name("TS_WalletSource_list_confirmed_utxos"))) TS_WalletSource_list_confirmed_utxos(uint64_t this_arg) {
14043         void* this_arg_ptr = untag_ptr(this_arg);
14044         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14045         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14046         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
14047         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
14048         return tag_ptr(ret_conv, true);
14049 }
14050
14051 uint64_t  __attribute__((export_name("TS_WalletSource_get_change_script"))) TS_WalletSource_get_change_script(uint64_t this_arg) {
14052         void* this_arg_ptr = untag_ptr(this_arg);
14053         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14054         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14055         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
14056         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
14057         return tag_ptr(ret_conv, true);
14058 }
14059
14060 uint64_t  __attribute__((export_name("TS_WalletSource_sign_tx"))) TS_WalletSource_sign_tx(uint64_t this_arg, int8_tArray tx) {
14061         void* this_arg_ptr = untag_ptr(this_arg);
14062         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
14063         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
14064         LDKTransaction tx_ref;
14065         tx_ref.datalen = tx->arr_len;
14066         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
14067         memcpy(tx_ref.data, tx->elems, tx_ref.datalen); FREE(tx);
14068         tx_ref.data_is_owned = true;
14069         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
14070         *ret_conv = (this_arg_conv->sign_tx)(this_arg_conv->this_arg, tx_ref);
14071         return tag_ptr(ret_conv, true);
14072 }
14073
14074 uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) {
14075         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14076         switch(obj->tag) {
14077                 case LDKGossipSync_P2P: return 0;
14078                 case LDKGossipSync_Rapid: return 1;
14079                 case LDKGossipSync_None: return 2;
14080                 default: abort();
14081         }
14082 }
14083 uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) {
14084         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14085         assert(obj->tag == LDKGossipSync_P2P);
14086                         LDKP2PGossipSync p2p_var = obj->p2p;
14087                         uint64_t p2p_ref = 0;
14088                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
14089                         p2p_ref = tag_ptr(p2p_var.inner, false);
14090         return p2p_ref;
14091 }
14092 uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) {
14093         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
14094         assert(obj->tag == LDKGossipSync_Rapid);
14095                         LDKRapidGossipSync rapid_var = obj->rapid;
14096                         uint64_t rapid_ref = 0;
14097                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
14098                         rapid_ref = tag_ptr(rapid_var.inner, false);
14099         return rapid_ref;
14100 }
14101 uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) {
14102         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14103         switch(obj->tag) {
14104                 case LDKFallback_SegWitProgram: return 0;
14105                 case LDKFallback_PubKeyHash: return 1;
14106                 case LDKFallback_ScriptHash: return 2;
14107                 default: abort();
14108         }
14109 }
14110 int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) {
14111         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14112         assert(obj->tag == LDKFallback_SegWitProgram);
14113                         uint8_t version_val = obj->seg_wit_program.version._0;
14114         return version_val;
14115 }
14116 int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) {
14117         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14118         assert(obj->tag == LDKFallback_SegWitProgram);
14119                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
14120                         int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__);
14121                         memcpy(program_arr->elems, program_var.data, program_var.datalen);
14122         return program_arr;
14123 }
14124 int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) {
14125         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14126         assert(obj->tag == LDKFallback_PubKeyHash);
14127                         int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__);
14128                         memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20);
14129         return pub_key_hash_arr;
14130 }
14131 int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) {
14132         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
14133         assert(obj->tag == LDKFallback_ScriptHash);
14134                         int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__);
14135                         memcpy(script_hash_arr->elems, obj->script_hash.data, 20);
14136         return script_hash_arr;
14137 }
14138 jstring  __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() {
14139         LDKStr ret_str = _ldk_get_compiled_version();
14140         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
14141         Str_free(ret_str);
14142         return ret_conv;
14143 }
14144
14145 jstring  __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) TS__ldk_c_bindings_get_compiled_version() {
14146         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
14147         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
14148         Str_free(ret_str);
14149         return ret_conv;
14150 }
14151
14152 int8_tArray  __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) {
14153         LDKU128 val_ref;
14154         CHECK(val->arr_len == 16);
14155         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
14156         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
14157         memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16);
14158         return ret_arr;
14159 }
14160
14161 int8_tArray  __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) {
14162         LDKSixteenBytes le_bytes_ref;
14163         CHECK(le_bytes->arr_len == 16);
14164         memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes);
14165         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
14166         memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16);
14167         return ret_arr;
14168 }
14169
14170 uint64_t  __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) {
14171         LDKThirtyTwoBytes big_endian_bytes_ref;
14172         CHECK(big_endian_bytes->arr_len == 32);
14173         memcpy(big_endian_bytes_ref.data, big_endian_bytes->elems, 32); FREE(big_endian_bytes);
14174         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
14175         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
14176         return tag_ptr(ret_ref, true);
14177 }
14178
14179 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
14180         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14181         *ret_copy = Bech32Error_clone(arg);
14182         uint64_t ret_ref = tag_ptr(ret_copy, true);
14183         return ret_ref;
14184 }
14185 int64_t  __attribute__((export_name("TS_Bech32Error_clone_ptr"))) TS_Bech32Error_clone_ptr(uint64_t arg) {
14186         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
14187         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
14188         return ret_conv;
14189 }
14190
14191 uint64_t  __attribute__((export_name("TS_Bech32Error_clone"))) TS_Bech32Error_clone(uint64_t orig) {
14192         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
14193         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
14194         *ret_copy = Bech32Error_clone(orig_conv);
14195         uint64_t ret_ref = tag_ptr(ret_copy, true);
14196         return ret_ref;
14197 }
14198
14199 void  __attribute__((export_name("TS_Bech32Error_free"))) TS_Bech32Error_free(uint64_t o) {
14200         if (!ptr_is_owned(o)) return;
14201         void* o_ptr = untag_ptr(o);
14202         CHECK_ACCESS(o_ptr);
14203         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
14204         FREE(untag_ptr(o));
14205         Bech32Error_free(o_conv);
14206 }
14207
14208 void  __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(int8_tArray _res) {
14209         LDKTransaction _res_ref;
14210         _res_ref.datalen = _res->arr_len;
14211         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
14212         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14213         _res_ref.data_is_owned = true;
14214         Transaction_free(_res_ref);
14215 }
14216
14217 void  __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) {
14218         LDKWitness _res_ref;
14219         _res_ref.datalen = _res->arr_len;
14220         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
14221         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14222         _res_ref.data_is_owned = true;
14223         Witness_free(_res_ref);
14224 }
14225
14226 void  __attribute__((export_name("TS_TxIn_free"))) TS_TxIn_free(uint64_t _res) {
14227         if (!ptr_is_owned(_res)) return;
14228         void* _res_ptr = untag_ptr(_res);
14229         CHECK_ACCESS(_res_ptr);
14230         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
14231         FREE(untag_ptr(_res));
14232         TxIn_free(_res_conv);
14233 }
14234
14235 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) {
14236         LDKWitness witness_ref;
14237         witness_ref.datalen = witness->arr_len;
14238         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
14239         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
14240         witness_ref.data_is_owned = true;
14241         LDKCVec_u8Z script_sig_ref;
14242         script_sig_ref.datalen = script_sig->arr_len;
14243         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
14244         memcpy(script_sig_ref.data, script_sig->elems, script_sig_ref.datalen); FREE(script_sig);
14245         LDKThirtyTwoBytes previous_txid_ref;
14246         CHECK(previous_txid->arr_len == 32);
14247         memcpy(previous_txid_ref.data, previous_txid->elems, 32); FREE(previous_txid);
14248         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
14249         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
14250         return tag_ptr(ret_ref, true);
14251 }
14252
14253 uint64_t  __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) {
14254         LDKCVec_u8Z script_pubkey_ref;
14255         script_pubkey_ref.datalen = script_pubkey->arr_len;
14256         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
14257         memcpy(script_pubkey_ref.data, script_pubkey->elems, script_pubkey_ref.datalen); FREE(script_pubkey);
14258         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14259         *ret_ref = TxOut_new(script_pubkey_ref, value);
14260         return tag_ptr(ret_ref, true);
14261 }
14262
14263 void  __attribute__((export_name("TS_TxOut_free"))) TS_TxOut_free(uint64_t _res) {
14264         if (!ptr_is_owned(_res)) return;
14265         void* _res_ptr = untag_ptr(_res);
14266         CHECK_ACCESS(_res_ptr);
14267         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
14268         FREE(untag_ptr(_res));
14269         TxOut_free(_res_conv);
14270 }
14271
14272 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
14273         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14274         *ret_ref = TxOut_clone(arg);
14275         return tag_ptr(ret_ref, true);
14276 }
14277 int64_t  __attribute__((export_name("TS_TxOut_clone_ptr"))) TS_TxOut_clone_ptr(uint64_t arg) {
14278         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
14279         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
14280         return ret_conv;
14281 }
14282
14283 uint64_t  __attribute__((export_name("TS_TxOut_clone"))) TS_TxOut_clone(uint64_t orig) {
14284         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
14285         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
14286         *ret_ref = TxOut_clone(orig_conv);
14287         return tag_ptr(ret_ref, true);
14288 }
14289
14290 void  __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) {
14291         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
14292         Str_free(dummy);
14293 }
14294
14295 uint64_t  __attribute__((export_name("TS_COption_DurationZ_some"))) TS_COption_DurationZ_some(int64_t o) {
14296         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
14297         *ret_copy = COption_DurationZ_some(o);
14298         uint64_t ret_ref = tag_ptr(ret_copy, true);
14299         return ret_ref;
14300 }
14301
14302 uint64_t  __attribute__((export_name("TS_COption_DurationZ_none"))) TS_COption_DurationZ_none() {
14303         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
14304         *ret_copy = COption_DurationZ_none();
14305         uint64_t ret_ref = tag_ptr(ret_copy, true);
14306         return ret_ref;
14307 }
14308
14309 void  __attribute__((export_name("TS_COption_DurationZ_free"))) TS_COption_DurationZ_free(uint64_t _res) {
14310         if (!ptr_is_owned(_res)) return;
14311         void* _res_ptr = untag_ptr(_res);
14312         CHECK_ACCESS(_res_ptr);
14313         LDKCOption_DurationZ _res_conv = *(LDKCOption_DurationZ*)(_res_ptr);
14314         FREE(untag_ptr(_res));
14315         COption_DurationZ_free(_res_conv);
14316 }
14317
14318 static inline uint64_t COption_DurationZ_clone_ptr(LDKCOption_DurationZ *NONNULL_PTR arg) {
14319         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
14320         *ret_copy = COption_DurationZ_clone(arg);
14321         uint64_t ret_ref = tag_ptr(ret_copy, true);
14322         return ret_ref;
14323 }
14324 int64_t  __attribute__((export_name("TS_COption_DurationZ_clone_ptr"))) TS_COption_DurationZ_clone_ptr(uint64_t arg) {
14325         LDKCOption_DurationZ* arg_conv = (LDKCOption_DurationZ*)untag_ptr(arg);
14326         int64_t ret_conv = COption_DurationZ_clone_ptr(arg_conv);
14327         return ret_conv;
14328 }
14329
14330 uint64_t  __attribute__((export_name("TS_COption_DurationZ_clone"))) TS_COption_DurationZ_clone(uint64_t orig) {
14331         LDKCOption_DurationZ* orig_conv = (LDKCOption_DurationZ*)untag_ptr(orig);
14332         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
14333         *ret_copy = COption_DurationZ_clone(orig_conv);
14334         uint64_t ret_ref = tag_ptr(ret_copy, true);
14335         return ret_ref;
14336 }
14337
14338 void  __attribute__((export_name("TS_CVec_BlindedPathZ_free"))) TS_CVec_BlindedPathZ_free(uint64_tArray _res) {
14339         LDKCVec_BlindedPathZ _res_constr;
14340         _res_constr.datalen = _res->arr_len;
14341         if (_res_constr.datalen > 0)
14342                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
14343         else
14344                 _res_constr.data = NULL;
14345         uint64_t* _res_vals = _res->elems;
14346         for (size_t n = 0; n < _res_constr.datalen; n++) {
14347                 uint64_t _res_conv_13 = _res_vals[n];
14348                 LDKBlindedPath _res_conv_13_conv;
14349                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
14350                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
14351                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
14352                 _res_constr.data[n] = _res_conv_13_conv;
14353         }
14354         FREE(_res);
14355         CVec_BlindedPathZ_free(_res_constr);
14356 }
14357
14358 uint64_t  __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) {
14359         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14360         *ret_copy = COption_u64Z_some(o);
14361         uint64_t ret_ref = tag_ptr(ret_copy, true);
14362         return ret_ref;
14363 }
14364
14365 uint64_t  __attribute__((export_name("TS_COption_u64Z_none"))) TS_COption_u64Z_none() {
14366         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14367         *ret_copy = COption_u64Z_none();
14368         uint64_t ret_ref = tag_ptr(ret_copy, true);
14369         return ret_ref;
14370 }
14371
14372 void  __attribute__((export_name("TS_COption_u64Z_free"))) TS_COption_u64Z_free(uint64_t _res) {
14373         if (!ptr_is_owned(_res)) return;
14374         void* _res_ptr = untag_ptr(_res);
14375         CHECK_ACCESS(_res_ptr);
14376         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
14377         FREE(untag_ptr(_res));
14378         COption_u64Z_free(_res_conv);
14379 }
14380
14381 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
14382         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14383         *ret_copy = COption_u64Z_clone(arg);
14384         uint64_t ret_ref = tag_ptr(ret_copy, true);
14385         return ret_ref;
14386 }
14387 int64_t  __attribute__((export_name("TS_COption_u64Z_clone_ptr"))) TS_COption_u64Z_clone_ptr(uint64_t arg) {
14388         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
14389         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
14390         return ret_conv;
14391 }
14392
14393 uint64_t  __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_clone(uint64_t orig) {
14394         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
14395         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
14396         *ret_copy = COption_u64Z_clone(orig_conv);
14397         uint64_t ret_ref = tag_ptr(ret_copy, true);
14398         return ret_ref;
14399 }
14400
14401 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_ok"))) TS_CResult_RefundBolt12ParseErrorZ_ok(uint64_t o) {
14402         LDKRefund o_conv;
14403         o_conv.inner = untag_ptr(o);
14404         o_conv.is_owned = ptr_is_owned(o);
14405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14406         o_conv = Refund_clone(&o_conv);
14407         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
14408         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
14409         return tag_ptr(ret_conv, true);
14410 }
14411
14412 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_err"))) TS_CResult_RefundBolt12ParseErrorZ_err(uint64_t e) {
14413         LDKBolt12ParseError e_conv;
14414         e_conv.inner = untag_ptr(e);
14415         e_conv.is_owned = ptr_is_owned(e);
14416         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
14417         e_conv = Bolt12ParseError_clone(&e_conv);
14418         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
14419         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
14420         return tag_ptr(ret_conv, true);
14421 }
14422
14423 jboolean  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_is_ok"))) TS_CResult_RefundBolt12ParseErrorZ_is_ok(uint64_t o) {
14424         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
14425         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
14426         return ret_conv;
14427 }
14428
14429 void  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_free"))) TS_CResult_RefundBolt12ParseErrorZ_free(uint64_t _res) {
14430         if (!ptr_is_owned(_res)) return;
14431         void* _res_ptr = untag_ptr(_res);
14432         CHECK_ACCESS(_res_ptr);
14433         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
14434         FREE(untag_ptr(_res));
14435         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
14436 }
14437
14438 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
14439         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
14440         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
14441         return tag_ptr(ret_conv, true);
14442 }
14443 int64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone_ptr"))) TS_CResult_RefundBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
14444         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
14445         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
14446         return ret_conv;
14447 }
14448
14449 uint64_t  __attribute__((export_name("TS_CResult_RefundBolt12ParseErrorZ_clone"))) TS_CResult_RefundBolt12ParseErrorZ_clone(uint64_t orig) {
14450         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
14451         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
14452         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
14453         return tag_ptr(ret_conv, true);
14454 }
14455
14456 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() {
14457         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14458         *ret_conv = CResult_NoneAPIErrorZ_ok();
14459         return tag_ptr(ret_conv, true);
14460 }
14461
14462 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) {
14463         void* e_ptr = untag_ptr(e);
14464         CHECK_ACCESS(e_ptr);
14465         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
14466         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
14467         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14468         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
14469         return tag_ptr(ret_conv, true);
14470 }
14471
14472 jboolean  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) {
14473         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
14474         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
14475         return ret_conv;
14476 }
14477
14478 void  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) {
14479         if (!ptr_is_owned(_res)) return;
14480         void* _res_ptr = untag_ptr(_res);
14481         CHECK_ACCESS(_res_ptr);
14482         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
14483         FREE(untag_ptr(_res));
14484         CResult_NoneAPIErrorZ_free(_res_conv);
14485 }
14486
14487 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
14488         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14489         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
14490         return tag_ptr(ret_conv, true);
14491 }
14492 int64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) {
14493         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
14494         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
14495         return ret_conv;
14496 }
14497
14498 uint64_t  __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) {
14499         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
14500         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
14501         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
14502         return tag_ptr(ret_conv, true);
14503 }
14504
14505 void  __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) {
14506         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
14507         _res_constr.datalen = _res->arr_len;
14508         if (_res_constr.datalen > 0)
14509                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
14510         else
14511                 _res_constr.data = NULL;
14512         uint64_t* _res_vals = _res->elems;
14513         for (size_t w = 0; w < _res_constr.datalen; w++) {
14514                 uint64_t _res_conv_22 = _res_vals[w];
14515                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
14516                 CHECK_ACCESS(_res_conv_22_ptr);
14517                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
14518                 FREE(untag_ptr(_res_conv_22));
14519                 _res_constr.data[w] = _res_conv_22_conv;
14520         }
14521         FREE(_res);
14522         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
14523 }
14524
14525 void  __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) {
14526         LDKCVec_APIErrorZ _res_constr;
14527         _res_constr.datalen = _res->arr_len;
14528         if (_res_constr.datalen > 0)
14529                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
14530         else
14531                 _res_constr.data = NULL;
14532         uint64_t* _res_vals = _res->elems;
14533         for (size_t k = 0; k < _res_constr.datalen; k++) {
14534                 uint64_t _res_conv_10 = _res_vals[k];
14535                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
14536                 CHECK_ACCESS(_res_conv_10_ptr);
14537                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
14538                 FREE(untag_ptr(_res_conv_10));
14539                 _res_constr.data[k] = _res_conv_10_conv;
14540         }
14541         FREE(_res);
14542         CVec_APIErrorZ_free(_res_constr);
14543 }
14544
14545 uint64_t  __attribute__((export_name("TS_COption_PaymentSecretZ_some"))) TS_COption_PaymentSecretZ_some(int8_tArray o) {
14546         LDKThirtyTwoBytes o_ref;
14547         CHECK(o->arr_len == 32);
14548         memcpy(o_ref.data, o->elems, 32); FREE(o);
14549         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
14550         *ret_copy = COption_PaymentSecretZ_some(o_ref);
14551         uint64_t ret_ref = tag_ptr(ret_copy, true);
14552         return ret_ref;
14553 }
14554
14555 uint64_t  __attribute__((export_name("TS_COption_PaymentSecretZ_none"))) TS_COption_PaymentSecretZ_none() {
14556         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
14557         *ret_copy = COption_PaymentSecretZ_none();
14558         uint64_t ret_ref = tag_ptr(ret_copy, true);
14559         return ret_ref;
14560 }
14561
14562 void  __attribute__((export_name("TS_COption_PaymentSecretZ_free"))) TS_COption_PaymentSecretZ_free(uint64_t _res) {
14563         if (!ptr_is_owned(_res)) return;
14564         void* _res_ptr = untag_ptr(_res);
14565         CHECK_ACCESS(_res_ptr);
14566         LDKCOption_PaymentSecretZ _res_conv = *(LDKCOption_PaymentSecretZ*)(_res_ptr);
14567         FREE(untag_ptr(_res));
14568         COption_PaymentSecretZ_free(_res_conv);
14569 }
14570
14571 static inline uint64_t COption_PaymentSecretZ_clone_ptr(LDKCOption_PaymentSecretZ *NONNULL_PTR arg) {
14572         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
14573         *ret_copy = COption_PaymentSecretZ_clone(arg);
14574         uint64_t ret_ref = tag_ptr(ret_copy, true);
14575         return ret_ref;
14576 }
14577 int64_t  __attribute__((export_name("TS_COption_PaymentSecretZ_clone_ptr"))) TS_COption_PaymentSecretZ_clone_ptr(uint64_t arg) {
14578         LDKCOption_PaymentSecretZ* arg_conv = (LDKCOption_PaymentSecretZ*)untag_ptr(arg);
14579         int64_t ret_conv = COption_PaymentSecretZ_clone_ptr(arg_conv);
14580         return ret_conv;
14581 }
14582
14583 uint64_t  __attribute__((export_name("TS_COption_PaymentSecretZ_clone"))) TS_COption_PaymentSecretZ_clone(uint64_t orig) {
14584         LDKCOption_PaymentSecretZ* orig_conv = (LDKCOption_PaymentSecretZ*)untag_ptr(orig);
14585         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
14586         *ret_copy = COption_PaymentSecretZ_clone(orig_conv);
14587         uint64_t ret_ref = tag_ptr(ret_copy, true);
14588         return ret_ref;
14589 }
14590
14591 void  __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) {
14592         LDKCVec_u8Z _res_ref;
14593         _res_ref.datalen = _res->arr_len;
14594         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
14595         memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res);
14596         CVec_u8Z_free(_res_ref);
14597 }
14598
14599 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_some"))) TS_COption_CVec_u8ZZ_some(int8_tArray o) {
14600         LDKCVec_u8Z o_ref;
14601         o_ref.datalen = o->arr_len;
14602         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
14603         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
14604         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
14605         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
14606         uint64_t ret_ref = tag_ptr(ret_copy, true);
14607         return ret_ref;
14608 }
14609
14610 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_none"))) TS_COption_CVec_u8ZZ_none() {
14611         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
14612         *ret_copy = COption_CVec_u8ZZ_none();
14613         uint64_t ret_ref = tag_ptr(ret_copy, true);
14614         return ret_ref;
14615 }
14616
14617 void  __attribute__((export_name("TS_COption_CVec_u8ZZ_free"))) TS_COption_CVec_u8ZZ_free(uint64_t _res) {
14618         if (!ptr_is_owned(_res)) return;
14619         void* _res_ptr = untag_ptr(_res);
14620         CHECK_ACCESS(_res_ptr);
14621         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
14622         FREE(untag_ptr(_res));
14623         COption_CVec_u8ZZ_free(_res_conv);
14624 }
14625
14626 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
14627         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
14628         *ret_copy = COption_CVec_u8ZZ_clone(arg);
14629         uint64_t ret_ref = tag_ptr(ret_copy, true);
14630         return ret_ref;
14631 }
14632 int64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone_ptr"))) TS_COption_CVec_u8ZZ_clone_ptr(uint64_t arg) {
14633         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
14634         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
14635         return ret_conv;
14636 }
14637
14638 uint64_t  __attribute__((export_name("TS_COption_CVec_u8ZZ_clone"))) TS_COption_CVec_u8ZZ_clone(uint64_t orig) {
14639         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
14640         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
14641         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
14642         uint64_t ret_ref = tag_ptr(ret_copy, true);
14643         return ret_ref;
14644 }
14645
14646 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_ok(uint64_t o) {
14647         LDKRecipientOnionFields o_conv;
14648         o_conv.inner = untag_ptr(o);
14649         o_conv.is_owned = ptr_is_owned(o);
14650         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14651         o_conv = RecipientOnionFields_clone(&o_conv);
14652         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
14653         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
14654         return tag_ptr(ret_conv, true);
14655 }
14656
14657 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_err"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_err(uint64_t e) {
14658         void* e_ptr = untag_ptr(e);
14659         CHECK_ACCESS(e_ptr);
14660         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14661         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14662         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
14663         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
14664         return tag_ptr(ret_conv, true);
14665 }
14666
14667 jboolean  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(uint64_t o) {
14668         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
14669         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
14670         return ret_conv;
14671 }
14672
14673 void  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_free"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_free(uint64_t _res) {
14674         if (!ptr_is_owned(_res)) return;
14675         void* _res_ptr = untag_ptr(_res);
14676         CHECK_ACCESS(_res_ptr);
14677         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
14678         FREE(untag_ptr(_res));
14679         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
14680 }
14681
14682 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
14683         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
14684         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
14685         return tag_ptr(ret_conv, true);
14686 }
14687 int64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(uint64_t arg) {
14688         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
14689         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
14690         return ret_conv;
14691 }
14692
14693 uint64_t  __attribute__((export_name("TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone"))) TS_CResult_RecipientOnionFieldsDecodeErrorZ_clone(uint64_t orig) {
14694         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
14695         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
14696         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
14697         return tag_ptr(ret_conv, true);
14698 }
14699
14700 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_some"))) TS_COption_OffersMessageZ_some(uint64_t o) {
14701         void* o_ptr = untag_ptr(o);
14702         CHECK_ACCESS(o_ptr);
14703         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
14704         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
14705         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14706         *ret_copy = COption_OffersMessageZ_some(o_conv);
14707         uint64_t ret_ref = tag_ptr(ret_copy, true);
14708         return ret_ref;
14709 }
14710
14711 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_none"))) TS_COption_OffersMessageZ_none() {
14712         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14713         *ret_copy = COption_OffersMessageZ_none();
14714         uint64_t ret_ref = tag_ptr(ret_copy, true);
14715         return ret_ref;
14716 }
14717
14718 void  __attribute__((export_name("TS_COption_OffersMessageZ_free"))) TS_COption_OffersMessageZ_free(uint64_t _res) {
14719         if (!ptr_is_owned(_res)) return;
14720         void* _res_ptr = untag_ptr(_res);
14721         CHECK_ACCESS(_res_ptr);
14722         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
14723         FREE(untag_ptr(_res));
14724         COption_OffersMessageZ_free(_res_conv);
14725 }
14726
14727 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
14728         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14729         *ret_copy = COption_OffersMessageZ_clone(arg);
14730         uint64_t ret_ref = tag_ptr(ret_copy, true);
14731         return ret_ref;
14732 }
14733 int64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone_ptr"))) TS_COption_OffersMessageZ_clone_ptr(uint64_t arg) {
14734         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
14735         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
14736         return ret_conv;
14737 }
14738
14739 uint64_t  __attribute__((export_name("TS_COption_OffersMessageZ_clone"))) TS_COption_OffersMessageZ_clone(uint64_t orig) {
14740         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
14741         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
14742         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
14743         uint64_t ret_ref = tag_ptr(ret_copy, true);
14744         return ret_ref;
14745 }
14746
14747 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_ok"))) TS_CResult_OffersMessageDecodeErrorZ_ok(uint64_t o) {
14748         void* o_ptr = untag_ptr(o);
14749         CHECK_ACCESS(o_ptr);
14750         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
14751         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
14752         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
14753         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
14754         return tag_ptr(ret_conv, true);
14755 }
14756
14757 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_err"))) TS_CResult_OffersMessageDecodeErrorZ_err(uint64_t e) {
14758         void* e_ptr = untag_ptr(e);
14759         CHECK_ACCESS(e_ptr);
14760         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14761         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14762         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
14763         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
14764         return tag_ptr(ret_conv, true);
14765 }
14766
14767 jboolean  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_is_ok"))) TS_CResult_OffersMessageDecodeErrorZ_is_ok(uint64_t o) {
14768         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
14769         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
14770         return ret_conv;
14771 }
14772
14773 void  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_free"))) TS_CResult_OffersMessageDecodeErrorZ_free(uint64_t _res) {
14774         if (!ptr_is_owned(_res)) return;
14775         void* _res_ptr = untag_ptr(_res);
14776         CHECK_ACCESS(_res_ptr);
14777         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
14778         FREE(untag_ptr(_res));
14779         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
14780 }
14781
14782 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
14783         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
14784         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
14785         return tag_ptr(ret_conv, true);
14786 }
14787 int64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OffersMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
14788         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
14789         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
14790         return ret_conv;
14791 }
14792
14793 uint64_t  __attribute__((export_name("TS_CResult_OffersMessageDecodeErrorZ_clone"))) TS_CResult_OffersMessageDecodeErrorZ_clone(uint64_t orig) {
14794         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
14795         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
14796         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
14797         return tag_ptr(ret_conv, true);
14798 }
14799
14800 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) {
14801         LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o);
14802         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
14803         *ret_copy = COption_HTLCClaimZ_some(o_conv);
14804         uint64_t ret_ref = tag_ptr(ret_copy, true);
14805         return ret_ref;
14806 }
14807
14808 uint64_t  __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() {
14809         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
14810         *ret_copy = COption_HTLCClaimZ_none();
14811         uint64_t ret_ref = tag_ptr(ret_copy, true);
14812         return ret_ref;
14813 }
14814
14815 void  __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) {
14816         if (!ptr_is_owned(_res)) return;
14817         void* _res_ptr = untag_ptr(_res);
14818         CHECK_ACCESS(_res_ptr);
14819         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
14820         FREE(untag_ptr(_res));
14821         COption_HTLCClaimZ_free(_res_conv);
14822 }
14823
14824 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() {
14825         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14826         *ret_conv = CResult_NoneNoneZ_ok();
14827         return tag_ptr(ret_conv, true);
14828 }
14829
14830 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_err"))) TS_CResult_NoneNoneZ_err() {
14831         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14832         *ret_conv = CResult_NoneNoneZ_err();
14833         return tag_ptr(ret_conv, true);
14834 }
14835
14836 jboolean  __attribute__((export_name("TS_CResult_NoneNoneZ_is_ok"))) TS_CResult_NoneNoneZ_is_ok(uint64_t o) {
14837         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
14838         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
14839         return ret_conv;
14840 }
14841
14842 void  __attribute__((export_name("TS_CResult_NoneNoneZ_free"))) TS_CResult_NoneNoneZ_free(uint64_t _res) {
14843         if (!ptr_is_owned(_res)) return;
14844         void* _res_ptr = untag_ptr(_res);
14845         CHECK_ACCESS(_res_ptr);
14846         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
14847         FREE(untag_ptr(_res));
14848         CResult_NoneNoneZ_free(_res_conv);
14849 }
14850
14851 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
14852         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14853         *ret_conv = CResult_NoneNoneZ_clone(arg);
14854         return tag_ptr(ret_conv, true);
14855 }
14856 int64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone_ptr"))) TS_CResult_NoneNoneZ_clone_ptr(uint64_t arg) {
14857         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
14858         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
14859         return ret_conv;
14860 }
14861
14862 uint64_t  __attribute__((export_name("TS_CResult_NoneNoneZ_clone"))) TS_CResult_NoneNoneZ_clone(uint64_t orig) {
14863         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
14864         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
14865         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
14866         return tag_ptr(ret_conv, true);
14867 }
14868
14869 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(uint64_t o) {
14870         LDKCounterpartyCommitmentSecrets o_conv;
14871         o_conv.inner = untag_ptr(o);
14872         o_conv.is_owned = ptr_is_owned(o);
14873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14874         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
14875         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14876         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
14877         return tag_ptr(ret_conv, true);
14878 }
14879
14880 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(uint64_t e) {
14881         void* e_ptr = untag_ptr(e);
14882         CHECK_ACCESS(e_ptr);
14883         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14884         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14885         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14886         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
14887         return tag_ptr(ret_conv, true);
14888 }
14889
14890 jboolean  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(uint64_t o) {
14891         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
14892         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
14893         return ret_conv;
14894 }
14895
14896 void  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(uint64_t _res) {
14897         if (!ptr_is_owned(_res)) return;
14898         void* _res_ptr = untag_ptr(_res);
14899         CHECK_ACCESS(_res_ptr);
14900         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
14901         FREE(untag_ptr(_res));
14902         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
14903 }
14904
14905 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
14906         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14907         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
14908         return tag_ptr(ret_conv, true);
14909 }
14910 int64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(uint64_t arg) {
14911         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
14912         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
14913         return ret_conv;
14914 }
14915
14916 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone"))) TS_CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(uint64_t orig) {
14917         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
14918         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
14919         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
14920         return tag_ptr(ret_conv, true);
14921 }
14922
14923 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) {
14924         LDKTxCreationKeys o_conv;
14925         o_conv.inner = untag_ptr(o);
14926         o_conv.is_owned = ptr_is_owned(o);
14927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14928         o_conv = TxCreationKeys_clone(&o_conv);
14929         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14930         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
14931         return tag_ptr(ret_conv, true);
14932 }
14933
14934 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) {
14935         void* e_ptr = untag_ptr(e);
14936         CHECK_ACCESS(e_ptr);
14937         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14938         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14939         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14940         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
14941         return tag_ptr(ret_conv, true);
14942 }
14943
14944 jboolean  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) {
14945         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
14946         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
14947         return ret_conv;
14948 }
14949
14950 void  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) {
14951         if (!ptr_is_owned(_res)) return;
14952         void* _res_ptr = untag_ptr(_res);
14953         CHECK_ACCESS(_res_ptr);
14954         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
14955         FREE(untag_ptr(_res));
14956         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
14957 }
14958
14959 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
14960         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14961         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
14962         return tag_ptr(ret_conv, true);
14963 }
14964 int64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
14965         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
14966         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
14967         return ret_conv;
14968 }
14969
14970 uint64_t  __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) {
14971         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
14972         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
14973         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
14974         return tag_ptr(ret_conv, true);
14975 }
14976
14977 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_ok(uint64_t o) {
14978         LDKChannelPublicKeys o_conv;
14979         o_conv.inner = untag_ptr(o);
14980         o_conv.is_owned = ptr_is_owned(o);
14981         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
14982         o_conv = ChannelPublicKeys_clone(&o_conv);
14983         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14984         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
14985         return tag_ptr(ret_conv, true);
14986 }
14987
14988 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_err"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_err(uint64_t e) {
14989         void* e_ptr = untag_ptr(e);
14990         CHECK_ACCESS(e_ptr);
14991         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
14992         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
14993         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
14994         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
14995         return tag_ptr(ret_conv, true);
14996 }
14997
14998 jboolean  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_is_ok(uint64_t o) {
14999         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
15000         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
15001         return ret_conv;
15002 }
15003
15004 void  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_free"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_free(uint64_t _res) {
15005         if (!ptr_is_owned(_res)) return;
15006         void* _res_ptr = untag_ptr(_res);
15007         CHECK_ACCESS(_res_ptr);
15008         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
15009         FREE(untag_ptr(_res));
15010         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
15011 }
15012
15013 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
15014         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15015         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
15016         return tag_ptr(ret_conv, true);
15017 }
15018 int64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(uint64_t arg) {
15019         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
15020         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
15021         return ret_conv;
15022 }
15023
15024 uint64_t  __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_clone"))) TS_CResult_ChannelPublicKeysDecodeErrorZ_clone(uint64_t orig) {
15025         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
15026         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
15027         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
15028         return tag_ptr(ret_conv, true);
15029 }
15030
15031 uint64_t  __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) {
15032         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15033         *ret_copy = COption_u32Z_some(o);
15034         uint64_t ret_ref = tag_ptr(ret_copy, true);
15035         return ret_ref;
15036 }
15037
15038 uint64_t  __attribute__((export_name("TS_COption_u32Z_none"))) TS_COption_u32Z_none() {
15039         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15040         *ret_copy = COption_u32Z_none();
15041         uint64_t ret_ref = tag_ptr(ret_copy, true);
15042         return ret_ref;
15043 }
15044
15045 void  __attribute__((export_name("TS_COption_u32Z_free"))) TS_COption_u32Z_free(uint64_t _res) {
15046         if (!ptr_is_owned(_res)) return;
15047         void* _res_ptr = untag_ptr(_res);
15048         CHECK_ACCESS(_res_ptr);
15049         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
15050         FREE(untag_ptr(_res));
15051         COption_u32Z_free(_res_conv);
15052 }
15053
15054 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
15055         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15056         *ret_copy = COption_u32Z_clone(arg);
15057         uint64_t ret_ref = tag_ptr(ret_copy, true);
15058         return ret_ref;
15059 }
15060 int64_t  __attribute__((export_name("TS_COption_u32Z_clone_ptr"))) TS_COption_u32Z_clone_ptr(uint64_t arg) {
15061         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
15062         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
15063         return ret_conv;
15064 }
15065
15066 uint64_t  __attribute__((export_name("TS_COption_u32Z_clone"))) TS_COption_u32Z_clone(uint64_t orig) {
15067         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
15068         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
15069         *ret_copy = COption_u32Z_clone(orig_conv);
15070         uint64_t ret_ref = tag_ptr(ret_copy, true);
15071         return ret_ref;
15072 }
15073
15074 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(uint64_t o) {
15075         LDKHTLCOutputInCommitment o_conv;
15076         o_conv.inner = untag_ptr(o);
15077         o_conv.is_owned = ptr_is_owned(o);
15078         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15079         o_conv = HTLCOutputInCommitment_clone(&o_conv);
15080         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15081         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
15082         return tag_ptr(ret_conv, true);
15083 }
15084
15085 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_err(uint64_t e) {
15086         void* e_ptr = untag_ptr(e);
15087         CHECK_ACCESS(e_ptr);
15088         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15089         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15090         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15091         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
15092         return tag_ptr(ret_conv, true);
15093 }
15094
15095 jboolean  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(uint64_t o) {
15096         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
15097         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
15098         return ret_conv;
15099 }
15100
15101 void  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_free(uint64_t _res) {
15102         if (!ptr_is_owned(_res)) return;
15103         void* _res_ptr = untag_ptr(_res);
15104         CHECK_ACCESS(_res_ptr);
15105         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
15106         FREE(untag_ptr(_res));
15107         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
15108 }
15109
15110 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
15111         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15112         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
15113         return tag_ptr(ret_conv, true);
15114 }
15115 int64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(uint64_t arg) {
15116         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
15117         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
15118         return ret_conv;
15119 }
15120
15121 uint64_t  __attribute__((export_name("TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone"))) TS_CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(uint64_t orig) {
15122         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
15123         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
15124         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
15125         return tag_ptr(ret_conv, true);
15126 }
15127
15128 uint64_t  __attribute__((export_name("TS_COption_PaymentPreimageZ_some"))) TS_COption_PaymentPreimageZ_some(int8_tArray o) {
15129         LDKThirtyTwoBytes o_ref;
15130         CHECK(o->arr_len == 32);
15131         memcpy(o_ref.data, o->elems, 32); FREE(o);
15132         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
15133         *ret_copy = COption_PaymentPreimageZ_some(o_ref);
15134         uint64_t ret_ref = tag_ptr(ret_copy, true);
15135         return ret_ref;
15136 }
15137
15138 uint64_t  __attribute__((export_name("TS_COption_PaymentPreimageZ_none"))) TS_COption_PaymentPreimageZ_none() {
15139         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
15140         *ret_copy = COption_PaymentPreimageZ_none();
15141         uint64_t ret_ref = tag_ptr(ret_copy, true);
15142         return ret_ref;
15143 }
15144
15145 void  __attribute__((export_name("TS_COption_PaymentPreimageZ_free"))) TS_COption_PaymentPreimageZ_free(uint64_t _res) {
15146         if (!ptr_is_owned(_res)) return;
15147         void* _res_ptr = untag_ptr(_res);
15148         CHECK_ACCESS(_res_ptr);
15149         LDKCOption_PaymentPreimageZ _res_conv = *(LDKCOption_PaymentPreimageZ*)(_res_ptr);
15150         FREE(untag_ptr(_res));
15151         COption_PaymentPreimageZ_free(_res_conv);
15152 }
15153
15154 static inline uint64_t COption_PaymentPreimageZ_clone_ptr(LDKCOption_PaymentPreimageZ *NONNULL_PTR arg) {
15155         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
15156         *ret_copy = COption_PaymentPreimageZ_clone(arg);
15157         uint64_t ret_ref = tag_ptr(ret_copy, true);
15158         return ret_ref;
15159 }
15160 int64_t  __attribute__((export_name("TS_COption_PaymentPreimageZ_clone_ptr"))) TS_COption_PaymentPreimageZ_clone_ptr(uint64_t arg) {
15161         LDKCOption_PaymentPreimageZ* arg_conv = (LDKCOption_PaymentPreimageZ*)untag_ptr(arg);
15162         int64_t ret_conv = COption_PaymentPreimageZ_clone_ptr(arg_conv);
15163         return ret_conv;
15164 }
15165
15166 uint64_t  __attribute__((export_name("TS_COption_PaymentPreimageZ_clone"))) TS_COption_PaymentPreimageZ_clone(uint64_t orig) {
15167         LDKCOption_PaymentPreimageZ* orig_conv = (LDKCOption_PaymentPreimageZ*)untag_ptr(orig);
15168         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
15169         *ret_copy = COption_PaymentPreimageZ_clone(orig_conv);
15170         uint64_t ret_ref = tag_ptr(ret_copy, true);
15171         return ret_ref;
15172 }
15173
15174 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
15175         LDKCounterpartyChannelTransactionParameters o_conv;
15176         o_conv.inner = untag_ptr(o);
15177         o_conv.is_owned = ptr_is_owned(o);
15178         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15179         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
15180         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15181         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15182         return tag_ptr(ret_conv, true);
15183 }
15184
15185 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
15186         void* e_ptr = untag_ptr(e);
15187         CHECK_ACCESS(e_ptr);
15188         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15189         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15190         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15191         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
15192         return tag_ptr(ret_conv, true);
15193 }
15194
15195 jboolean  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
15196         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
15197         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15198         return ret_conv;
15199 }
15200
15201 void  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
15202         if (!ptr_is_owned(_res)) return;
15203         void* _res_ptr = untag_ptr(_res);
15204         CHECK_ACCESS(_res_ptr);
15205         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15206         FREE(untag_ptr(_res));
15207         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15208 }
15209
15210 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15211         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15212         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
15213         return tag_ptr(ret_conv, true);
15214 }
15215 int64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
15216         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
15217         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15218         return ret_conv;
15219 }
15220
15221 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
15222         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
15223         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
15224         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15225         return tag_ptr(ret_conv, true);
15226 }
15227
15228 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_ok(uint64_t o) {
15229         LDKChannelTransactionParameters o_conv;
15230         o_conv.inner = untag_ptr(o);
15231         o_conv.is_owned = ptr_is_owned(o);
15232         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15233         o_conv = ChannelTransactionParameters_clone(&o_conv);
15234         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15235         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
15236         return tag_ptr(ret_conv, true);
15237 }
15238
15239 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_err"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_err(uint64_t e) {
15240         void* e_ptr = untag_ptr(e);
15241         CHECK_ACCESS(e_ptr);
15242         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15243         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15244         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15245         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
15246         return tag_ptr(ret_conv, true);
15247 }
15248
15249 jboolean  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(uint64_t o) {
15250         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
15251         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
15252         return ret_conv;
15253 }
15254
15255 void  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_free"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_free(uint64_t _res) {
15256         if (!ptr_is_owned(_res)) return;
15257         void* _res_ptr = untag_ptr(_res);
15258         CHECK_ACCESS(_res_ptr);
15259         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
15260         FREE(untag_ptr(_res));
15261         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
15262 }
15263
15264 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
15265         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15266         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
15267         return tag_ptr(ret_conv, true);
15268 }
15269 int64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
15270         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
15271         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
15272         return ret_conv;
15273 }
15274
15275 uint64_t  __attribute__((export_name("TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone"))) TS_CResult_ChannelTransactionParametersDecodeErrorZ_clone(uint64_t orig) {
15276         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
15277         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
15278         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
15279         return tag_ptr(ret_conv, true);
15280 }
15281
15282 void  __attribute__((export_name("TS_CVec_SignatureZ_free"))) TS_CVec_SignatureZ_free(ptrArray _res) {
15283         LDKCVec_SignatureZ _res_constr;
15284         _res_constr.datalen = _res->arr_len;
15285         if (_res_constr.datalen > 0)
15286                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15287         else
15288                 _res_constr.data = NULL;
15289         int8_tArray* _res_vals = (void*) _res->elems;
15290         for (size_t m = 0; m < _res_constr.datalen; m++) {
15291                 int8_tArray _res_conv_12 = _res_vals[m];
15292                 LDKSignature _res_conv_12_ref;
15293                 CHECK(_res_conv_12->arr_len == 64);
15294                 memcpy(_res_conv_12_ref.compact_form, _res_conv_12->elems, 64); FREE(_res_conv_12);
15295                 _res_constr.data[m] = _res_conv_12_ref;
15296         }
15297         FREE(_res);
15298         CVec_SignatureZ_free(_res_constr);
15299 }
15300
15301 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
15302         LDKHolderCommitmentTransaction o_conv;
15303         o_conv.inner = untag_ptr(o);
15304         o_conv.is_owned = ptr_is_owned(o);
15305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15306         o_conv = HolderCommitmentTransaction_clone(&o_conv);
15307         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15308         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
15309         return tag_ptr(ret_conv, true);
15310 }
15311
15312 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
15313         void* e_ptr = untag_ptr(e);
15314         CHECK_ACCESS(e_ptr);
15315         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15316         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15317         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15318         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
15319         return tag_ptr(ret_conv, true);
15320 }
15321
15322 jboolean  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
15323         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
15324         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15325         return ret_conv;
15326 }
15327
15328 void  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
15329         if (!ptr_is_owned(_res)) return;
15330         void* _res_ptr = untag_ptr(_res);
15331         CHECK_ACCESS(_res_ptr);
15332         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15333         FREE(untag_ptr(_res));
15334         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
15335 }
15336
15337 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15338         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15339         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
15340         return tag_ptr(ret_conv, true);
15341 }
15342 int64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
15343         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
15344         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15345         return ret_conv;
15346 }
15347
15348 uint64_t  __attribute__((export_name("TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_HolderCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
15349         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
15350         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
15351         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15352         return tag_ptr(ret_conv, true);
15353 }
15354
15355 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
15356         LDKBuiltCommitmentTransaction o_conv;
15357         o_conv.inner = untag_ptr(o);
15358         o_conv.is_owned = ptr_is_owned(o);
15359         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15360         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
15361         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15362         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
15363         return tag_ptr(ret_conv, true);
15364 }
15365
15366 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_err(uint64_t e) {
15367         void* e_ptr = untag_ptr(e);
15368         CHECK_ACCESS(e_ptr);
15369         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15370         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15371         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15372         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
15373         return tag_ptr(ret_conv, true);
15374 }
15375
15376 jboolean  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
15377         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
15378         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15379         return ret_conv;
15380 }
15381
15382 void  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
15383         if (!ptr_is_owned(_res)) return;
15384         void* _res_ptr = untag_ptr(_res);
15385         CHECK_ACCESS(_res_ptr);
15386         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
15387         FREE(untag_ptr(_res));
15388         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
15389 }
15390
15391 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15392         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15393         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
15394         return tag_ptr(ret_conv, true);
15395 }
15396 int64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
15397         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
15398         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15399         return ret_conv;
15400 }
15401
15402 uint64_t  __attribute__((export_name("TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
15403         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
15404         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
15405         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
15406         return tag_ptr(ret_conv, true);
15407 }
15408
15409 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint64_t o) {
15410         LDKTrustedClosingTransaction o_conv;
15411         o_conv.inner = untag_ptr(o);
15412         o_conv.is_owned = ptr_is_owned(o);
15413         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15414         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
15415         
15416         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15417         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
15418         return tag_ptr(ret_conv, true);
15419 }
15420
15421 uint64_t  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_err"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
15422         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
15423         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
15424         return tag_ptr(ret_conv, true);
15425 }
15426
15427 jboolean  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_is_ok"))) TS_CResult_TrustedClosingTransactionNoneZ_is_ok(uint64_t o) {
15428         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
15429         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
15430         return ret_conv;
15431 }
15432
15433 void  __attribute__((export_name("TS_CResult_TrustedClosingTransactionNoneZ_free"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint64_t _res) {
15434         if (!ptr_is_owned(_res)) return;
15435         void* _res_ptr = untag_ptr(_res);
15436         CHECK_ACCESS(_res_ptr);
15437         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
15438         FREE(untag_ptr(_res));
15439         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
15440 }
15441
15442 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint64_t o) {
15443         LDKCommitmentTransaction o_conv;
15444         o_conv.inner = untag_ptr(o);
15445         o_conv.is_owned = ptr_is_owned(o);
15446         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15447         o_conv = CommitmentTransaction_clone(&o_conv);
15448         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15449         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
15450         return tag_ptr(ret_conv, true);
15451 }
15452
15453 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_err"))) TS_CResult_CommitmentTransactionDecodeErrorZ_err(uint64_t e) {
15454         void* e_ptr = untag_ptr(e);
15455         CHECK_ACCESS(e_ptr);
15456         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15457         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15458         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15459         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
15460         return tag_ptr(ret_conv, true);
15461 }
15462
15463 jboolean  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok"))) TS_CResult_CommitmentTransactionDecodeErrorZ_is_ok(uint64_t o) {
15464         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
15465         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
15466         return ret_conv;
15467 }
15468
15469 void  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_free"))) TS_CResult_CommitmentTransactionDecodeErrorZ_free(uint64_t _res) {
15470         if (!ptr_is_owned(_res)) return;
15471         void* _res_ptr = untag_ptr(_res);
15472         CHECK_ACCESS(_res_ptr);
15473         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
15474         FREE(untag_ptr(_res));
15475         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
15476 }
15477
15478 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
15479         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15480         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
15481         return tag_ptr(ret_conv, true);
15482 }
15483 int64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(uint64_t arg) {
15484         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
15485         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
15486         return ret_conv;
15487 }
15488
15489 uint64_t  __attribute__((export_name("TS_CResult_CommitmentTransactionDecodeErrorZ_clone"))) TS_CResult_CommitmentTransactionDecodeErrorZ_clone(uint64_t orig) {
15490         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
15491         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
15492         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
15493         return tag_ptr(ret_conv, true);
15494 }
15495
15496 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_ok(uint64_t o) {
15497         LDKTrustedCommitmentTransaction o_conv;
15498         o_conv.inner = untag_ptr(o);
15499         o_conv.is_owned = ptr_is_owned(o);
15500         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15501         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
15502         
15503         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15504         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
15505         return tag_ptr(ret_conv, true);
15506 }
15507
15508 uint64_t  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_err"))) TS_CResult_TrustedCommitmentTransactionNoneZ_err() {
15509         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15510         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
15511         return tag_ptr(ret_conv, true);
15512 }
15513
15514 jboolean  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok"))) TS_CResult_TrustedCommitmentTransactionNoneZ_is_ok(uint64_t o) {
15515         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
15516         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
15517         return ret_conv;
15518 }
15519
15520 void  __attribute__((export_name("TS_CResult_TrustedCommitmentTransactionNoneZ_free"))) TS_CResult_TrustedCommitmentTransactionNoneZ_free(uint64_t _res) {
15521         if (!ptr_is_owned(_res)) return;
15522         void* _res_ptr = untag_ptr(_res);
15523         CHECK_ACCESS(_res_ptr);
15524         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
15525         FREE(untag_ptr(_res));
15526         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
15527 }
15528
15529 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_ok"))) TS_CResult_CVec_SignatureZNoneZ_ok(ptrArray o) {
15530         LDKCVec_SignatureZ o_constr;
15531         o_constr.datalen = o->arr_len;
15532         if (o_constr.datalen > 0)
15533                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15534         else
15535                 o_constr.data = NULL;
15536         int8_tArray* o_vals = (void*) o->elems;
15537         for (size_t m = 0; m < o_constr.datalen; m++) {
15538                 int8_tArray o_conv_12 = o_vals[m];
15539                 LDKSignature o_conv_12_ref;
15540                 CHECK(o_conv_12->arr_len == 64);
15541                 memcpy(o_conv_12_ref.compact_form, o_conv_12->elems, 64); FREE(o_conv_12);
15542                 o_constr.data[m] = o_conv_12_ref;
15543         }
15544         FREE(o);
15545         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15546         *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
15547         return tag_ptr(ret_conv, true);
15548 }
15549
15550 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_err"))) TS_CResult_CVec_SignatureZNoneZ_err() {
15551         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15552         *ret_conv = CResult_CVec_SignatureZNoneZ_err();
15553         return tag_ptr(ret_conv, true);
15554 }
15555
15556 jboolean  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_is_ok"))) TS_CResult_CVec_SignatureZNoneZ_is_ok(uint64_t o) {
15557         LDKCResult_CVec_SignatureZNoneZ* o_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(o);
15558         jboolean ret_conv = CResult_CVec_SignatureZNoneZ_is_ok(o_conv);
15559         return ret_conv;
15560 }
15561
15562 void  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_free"))) TS_CResult_CVec_SignatureZNoneZ_free(uint64_t _res) {
15563         if (!ptr_is_owned(_res)) return;
15564         void* _res_ptr = untag_ptr(_res);
15565         CHECK_ACCESS(_res_ptr);
15566         LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(_res_ptr);
15567         FREE(untag_ptr(_res));
15568         CResult_CVec_SignatureZNoneZ_free(_res_conv);
15569 }
15570
15571 static inline uint64_t CResult_CVec_SignatureZNoneZ_clone_ptr(LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR arg) {
15572         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15573         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(arg);
15574         return tag_ptr(ret_conv, true);
15575 }
15576 int64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone_ptr"))) TS_CResult_CVec_SignatureZNoneZ_clone_ptr(uint64_t arg) {
15577         LDKCResult_CVec_SignatureZNoneZ* arg_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(arg);
15578         int64_t ret_conv = CResult_CVec_SignatureZNoneZ_clone_ptr(arg_conv);
15579         return ret_conv;
15580 }
15581
15582 uint64_t  __attribute__((export_name("TS_CResult_CVec_SignatureZNoneZ_clone"))) TS_CResult_CVec_SignatureZNoneZ_clone(uint64_t orig) {
15583         LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)untag_ptr(orig);
15584         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15585         *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
15586         return tag_ptr(ret_conv, true);
15587 }
15588
15589 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint64_t o) {
15590         LDKShutdownScript o_conv;
15591         o_conv.inner = untag_ptr(o);
15592         o_conv.is_owned = ptr_is_owned(o);
15593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15594         o_conv = ShutdownScript_clone(&o_conv);
15595         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15596         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
15597         return tag_ptr(ret_conv, true);
15598 }
15599
15600 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_err"))) TS_CResult_ShutdownScriptDecodeErrorZ_err(uint64_t e) {
15601         void* e_ptr = untag_ptr(e);
15602         CHECK_ACCESS(e_ptr);
15603         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15604         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15605         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15606         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
15607         return tag_ptr(ret_conv, true);
15608 }
15609
15610 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_is_ok"))) TS_CResult_ShutdownScriptDecodeErrorZ_is_ok(uint64_t o) {
15611         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
15612         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
15613         return ret_conv;
15614 }
15615
15616 void  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_free"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint64_t _res) {
15617         if (!ptr_is_owned(_res)) return;
15618         void* _res_ptr = untag_ptr(_res);
15619         CHECK_ACCESS(_res_ptr);
15620         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
15621         FREE(untag_ptr(_res));
15622         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
15623 }
15624
15625 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
15626         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15627         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
15628         return tag_ptr(ret_conv, true);
15629 }
15630 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone_ptr(uint64_t arg) {
15631         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
15632         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
15633         return ret_conv;
15634 }
15635
15636 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptDecodeErrorZ_clone"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint64_t orig) {
15637         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
15638         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
15639         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
15640         return tag_ptr(ret_conv, true);
15641 }
15642
15643 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint64_t o) {
15644         LDKShutdownScript o_conv;
15645         o_conv.inner = untag_ptr(o);
15646         o_conv.is_owned = ptr_is_owned(o);
15647         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15648         o_conv = ShutdownScript_clone(&o_conv);
15649         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15650         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
15651         return tag_ptr(ret_conv, true);
15652 }
15653
15654 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint64_t e) {
15655         LDKInvalidShutdownScript e_conv;
15656         e_conv.inner = untag_ptr(e);
15657         e_conv.is_owned = ptr_is_owned(e);
15658         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
15659         e_conv = InvalidShutdownScript_clone(&e_conv);
15660         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15661         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
15662         return tag_ptr(ret_conv, true);
15663 }
15664
15665 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(uint64_t o) {
15666         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
15667         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
15668         return ret_conv;
15669 }
15670
15671 void  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint64_t _res) {
15672         if (!ptr_is_owned(_res)) return;
15673         void* _res_ptr = untag_ptr(_res);
15674         CHECK_ACCESS(_res_ptr);
15675         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
15676         FREE(untag_ptr(_res));
15677         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
15678 }
15679
15680 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
15681         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15682         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
15683         return tag_ptr(ret_conv, true);
15684 }
15685 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(uint64_t arg) {
15686         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
15687         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
15688         return ret_conv;
15689 }
15690
15691 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_clone(uint64_t orig) {
15692         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
15693         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
15694         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
15695         return tag_ptr(ret_conv, true);
15696 }
15697
15698 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_ok(uint64_t o) {
15699         LDKBlindedPayInfo o_conv;
15700         o_conv.inner = untag_ptr(o);
15701         o_conv.is_owned = ptr_is_owned(o);
15702         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15703         o_conv = BlindedPayInfo_clone(&o_conv);
15704         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15705         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
15706         return tag_ptr(ret_conv, true);
15707 }
15708
15709 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_err"))) TS_CResult_BlindedPayInfoDecodeErrorZ_err(uint64_t e) {
15710         void* e_ptr = untag_ptr(e);
15711         CHECK_ACCESS(e_ptr);
15712         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15713         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15714         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15715         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
15716         return tag_ptr(ret_conv, true);
15717 }
15718
15719 jboolean  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok"))) TS_CResult_BlindedPayInfoDecodeErrorZ_is_ok(uint64_t o) {
15720         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
15721         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
15722         return ret_conv;
15723 }
15724
15725 void  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_free"))) TS_CResult_BlindedPayInfoDecodeErrorZ_free(uint64_t _res) {
15726         if (!ptr_is_owned(_res)) return;
15727         void* _res_ptr = untag_ptr(_res);
15728         CHECK_ACCESS(_res_ptr);
15729         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
15730         FREE(untag_ptr(_res));
15731         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
15732 }
15733
15734 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
15735         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15736         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
15737         return tag_ptr(ret_conv, true);
15738 }
15739 int64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
15740         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
15741         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
15742         return ret_conv;
15743 }
15744
15745 uint64_t  __attribute__((export_name("TS_CResult_BlindedPayInfoDecodeErrorZ_clone"))) TS_CResult_BlindedPayInfoDecodeErrorZ_clone(uint64_t orig) {
15746         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
15747         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
15748         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
15749         return tag_ptr(ret_conv, true);
15750 }
15751
15752 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15753         LDKDelayedPaymentOutputDescriptor o_conv;
15754         o_conv.inner = untag_ptr(o);
15755         o_conv.is_owned = ptr_is_owned(o);
15756         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15757         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
15758         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15759         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15760         return tag_ptr(ret_conv, true);
15761 }
15762
15763 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15764         void* e_ptr = untag_ptr(e);
15765         CHECK_ACCESS(e_ptr);
15766         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15767         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15768         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15769         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15770         return tag_ptr(ret_conv, true);
15771 }
15772
15773 jboolean  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15774         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15775         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15776         return ret_conv;
15777 }
15778
15779 void  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15780         if (!ptr_is_owned(_res)) return;
15781         void* _res_ptr = untag_ptr(_res);
15782         CHECK_ACCESS(_res_ptr);
15783         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15784         FREE(untag_ptr(_res));
15785         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15786 }
15787
15788 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15789         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15790         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15791         return tag_ptr(ret_conv, true);
15792 }
15793 int64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15794         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15795         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15796         return ret_conv;
15797 }
15798
15799 uint64_t  __attribute__((export_name("TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15800         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15801         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15802         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15803         return tag_ptr(ret_conv, true);
15804 }
15805
15806 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15807         LDKStaticPaymentOutputDescriptor o_conv;
15808         o_conv.inner = untag_ptr(o);
15809         o_conv.is_owned = ptr_is_owned(o);
15810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
15811         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
15812         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15813         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
15814         return tag_ptr(ret_conv, true);
15815 }
15816
15817 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15818         void* e_ptr = untag_ptr(e);
15819         CHECK_ACCESS(e_ptr);
15820         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15821         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15822         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15823         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
15824         return tag_ptr(ret_conv, true);
15825 }
15826
15827 jboolean  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15828         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15829         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15830         return ret_conv;
15831 }
15832
15833 void  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15834         if (!ptr_is_owned(_res)) return;
15835         void* _res_ptr = untag_ptr(_res);
15836         CHECK_ACCESS(_res_ptr);
15837         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
15838         FREE(untag_ptr(_res));
15839         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
15840 }
15841
15842 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15843         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15844         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
15845         return tag_ptr(ret_conv, true);
15846 }
15847 int64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15848         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15849         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15850         return ret_conv;
15851 }
15852
15853 uint64_t  __attribute__((export_name("TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15854         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15855         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15856         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
15857         return tag_ptr(ret_conv, true);
15858 }
15859
15860 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint64_t o) {
15861         void* o_ptr = untag_ptr(o);
15862         CHECK_ACCESS(o_ptr);
15863         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
15864         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
15865         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15866         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
15867         return tag_ptr(ret_conv, true);
15868 }
15869
15870 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_err(uint64_t e) {
15871         void* e_ptr = untag_ptr(e);
15872         CHECK_ACCESS(e_ptr);
15873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
15874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
15875         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15876         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
15877         return tag_ptr(ret_conv, true);
15878 }
15879
15880 jboolean  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(uint64_t o) {
15881         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
15882         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
15883         return ret_conv;
15884 }
15885
15886 void  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_free(uint64_t _res) {
15887         if (!ptr_is_owned(_res)) return;
15888         void* _res_ptr = untag_ptr(_res);
15889         CHECK_ACCESS(_res_ptr);
15890         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
15891         FREE(untag_ptr(_res));
15892         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
15893 }
15894
15895 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
15896         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15897         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
15898         return tag_ptr(ret_conv, true);
15899 }
15900 int64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(uint64_t arg) {
15901         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
15902         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
15903         return ret_conv;
15904 }
15905
15906 uint64_t  __attribute__((export_name("TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_clone(uint64_t orig) {
15907         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
15908         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15909         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
15910         return tag_ptr(ret_conv, true);
15911 }
15912
15913 void  __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) {
15914         LDKCVec_SpendableOutputDescriptorZ _res_constr;
15915         _res_constr.datalen = _res->arr_len;
15916         if (_res_constr.datalen > 0)
15917                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15918         else
15919                 _res_constr.data = NULL;
15920         uint64_t* _res_vals = _res->elems;
15921         for (size_t b = 0; b < _res_constr.datalen; b++) {
15922                 uint64_t _res_conv_27 = _res_vals[b];
15923                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
15924                 CHECK_ACCESS(_res_conv_27_ptr);
15925                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
15926                 FREE(untag_ptr(_res_conv_27));
15927                 _res_constr.data[b] = _res_conv_27_conv;
15928         }
15929         FREE(_res);
15930         CVec_SpendableOutputDescriptorZ_free(_res_constr);
15931 }
15932
15933 void  __attribute__((export_name("TS_CVec_TxOutZ_free"))) TS_CVec_TxOutZ_free(uint64_tArray _res) {
15934         LDKCVec_TxOutZ _res_constr;
15935         _res_constr.datalen = _res->arr_len;
15936         if (_res_constr.datalen > 0)
15937                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15938         else
15939                 _res_constr.data = NULL;
15940         uint64_t* _res_vals = _res->elems;
15941         for (size_t h = 0; h < _res_constr.datalen; h++) {
15942                 uint64_t _res_conv_7 = _res_vals[h];
15943                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
15944                 CHECK_ACCESS(_res_conv_7_ptr);
15945                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
15946                 FREE(untag_ptr(_res_conv_7));
15947                 _res_constr.data[h] = _res_conv_7_conv;
15948         }
15949         FREE(_res);
15950         CVec_TxOutZ_free(_res_constr);
15951 }
15952
15953 uint64_t  __attribute__((export_name("TS_COption_PackedLockTimeZ_some"))) TS_COption_PackedLockTimeZ_some(int32_t o) {
15954         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
15955         *ret_copy = COption_PackedLockTimeZ_some(o);
15956         uint64_t ret_ref = tag_ptr(ret_copy, true);
15957         return ret_ref;
15958 }
15959
15960 uint64_t  __attribute__((export_name("TS_COption_PackedLockTimeZ_none"))) TS_COption_PackedLockTimeZ_none() {
15961         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
15962         *ret_copy = COption_PackedLockTimeZ_none();
15963         uint64_t ret_ref = tag_ptr(ret_copy, true);
15964         return ret_ref;
15965 }
15966
15967 void  __attribute__((export_name("TS_COption_PackedLockTimeZ_free"))) TS_COption_PackedLockTimeZ_free(uint64_t _res) {
15968         if (!ptr_is_owned(_res)) return;
15969         void* _res_ptr = untag_ptr(_res);
15970         CHECK_ACCESS(_res_ptr);
15971         LDKCOption_PackedLockTimeZ _res_conv = *(LDKCOption_PackedLockTimeZ*)(_res_ptr);
15972         FREE(untag_ptr(_res));
15973         COption_PackedLockTimeZ_free(_res_conv);
15974 }
15975
15976 static inline uint64_t COption_PackedLockTimeZ_clone_ptr(LDKCOption_PackedLockTimeZ *NONNULL_PTR arg) {
15977         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
15978         *ret_copy = COption_PackedLockTimeZ_clone(arg);
15979         uint64_t ret_ref = tag_ptr(ret_copy, true);
15980         return ret_ref;
15981 }
15982 int64_t  __attribute__((export_name("TS_COption_PackedLockTimeZ_clone_ptr"))) TS_COption_PackedLockTimeZ_clone_ptr(uint64_t arg) {
15983         LDKCOption_PackedLockTimeZ* arg_conv = (LDKCOption_PackedLockTimeZ*)untag_ptr(arg);
15984         int64_t ret_conv = COption_PackedLockTimeZ_clone_ptr(arg_conv);
15985         return ret_conv;
15986 }
15987
15988 uint64_t  __attribute__((export_name("TS_COption_PackedLockTimeZ_clone"))) TS_COption_PackedLockTimeZ_clone(uint64_t orig) {
15989         LDKCOption_PackedLockTimeZ* orig_conv = (LDKCOption_PackedLockTimeZ*)untag_ptr(orig);
15990         LDKCOption_PackedLockTimeZ *ret_copy = MALLOC(sizeof(LDKCOption_PackedLockTimeZ), "LDKCOption_PackedLockTimeZ");
15991         *ret_copy = COption_PackedLockTimeZ_clone(orig_conv);
15992         uint64_t ret_ref = tag_ptr(ret_copy, true);
15993         return ret_ref;
15994 }
15995
15996 static inline uint64_t C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(LDKC2Tuple_PartiallySignedTransactionusizeZ *NONNULL_PTR arg) {
15997         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
15998         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone(arg);
15999         return tag_ptr(ret_conv, true);
16000 }
16001 int64_t  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(uint64_t arg) {
16002         LDKC2Tuple_PartiallySignedTransactionusizeZ* arg_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(arg);
16003         int64_t ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone_ptr(arg_conv);
16004         return ret_conv;
16005 }
16006
16007 uint64_t  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_clone"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_clone(uint64_t orig) {
16008         LDKC2Tuple_PartiallySignedTransactionusizeZ* orig_conv = (LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(orig);
16009         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
16010         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone(orig_conv);
16011         return tag_ptr(ret_conv, true);
16012 }
16013
16014 uint64_t  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_new"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_new(int8_tArray a, uint32_t b) {
16015         LDKCVec_u8Z a_ref;
16016         a_ref.datalen = a->arr_len;
16017         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
16018         memcpy(a_ref.data, a->elems, a_ref.datalen); FREE(a);
16019         LDKC2Tuple_PartiallySignedTransactionusizeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PartiallySignedTransactionusizeZ), "LDKC2Tuple_PartiallySignedTransactionusizeZ");
16020         *ret_conv = C2Tuple_PartiallySignedTransactionusizeZ_new(a_ref, b);
16021         return tag_ptr(ret_conv, true);
16022 }
16023
16024 void  __attribute__((export_name("TS_C2Tuple_PartiallySignedTransactionusizeZ_free"))) TS_C2Tuple_PartiallySignedTransactionusizeZ_free(uint64_t _res) {
16025         if (!ptr_is_owned(_res)) return;
16026         void* _res_ptr = untag_ptr(_res);
16027         CHECK_ACCESS(_res_ptr);
16028         LDKC2Tuple_PartiallySignedTransactionusizeZ _res_conv = *(LDKC2Tuple_PartiallySignedTransactionusizeZ*)(_res_ptr);
16029         FREE(untag_ptr(_res));
16030         C2Tuple_PartiallySignedTransactionusizeZ_free(_res_conv);
16031 }
16032
16033 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(uint64_t o) {
16034         void* o_ptr = untag_ptr(o);
16035         CHECK_ACCESS(o_ptr);
16036         LDKC2Tuple_PartiallySignedTransactionusizeZ o_conv = *(LDKC2Tuple_PartiallySignedTransactionusizeZ*)(o_ptr);
16037         o_conv = C2Tuple_PartiallySignedTransactionusizeZ_clone((LDKC2Tuple_PartiallySignedTransactionusizeZ*)untag_ptr(o));
16038         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
16039         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_ok(o_conv);
16040         return tag_ptr(ret_conv, true);
16041 }
16042
16043 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err() {
16044         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
16045         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_err();
16046         return tag_ptr(ret_conv, true);
16047 }
16048
16049 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(uint64_t o) {
16050         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* o_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(o);
16051         jboolean ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_is_ok(o_conv);
16052         return ret_conv;
16053 }
16054
16055 void  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(uint64_t _res) {
16056         if (!ptr_is_owned(_res)) return;
16057         void* _res_ptr = untag_ptr(_res);
16058         CHECK_ACCESS(_res_ptr);
16059         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ _res_conv = *(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)(_res_ptr);
16060         FREE(untag_ptr(_res));
16061         CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_free(_res_conv);
16062 }
16063
16064 static inline uint64_t CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ *NONNULL_PTR arg) {
16065         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
16066         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(arg);
16067         return tag_ptr(ret_conv, true);
16068 }
16069 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(uint64_t arg) {
16070         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* arg_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(arg);
16071         int64_t ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone_ptr(arg_conv);
16072         return ret_conv;
16073 }
16074
16075 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone"))) TS_CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(uint64_t orig) {
16076         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* orig_conv = (LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ*)untag_ptr(orig);
16077         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
16078         *ret_conv = CResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ_clone(orig_conv);
16079         return tag_ptr(ret_conv, true);
16080 }
16081
16082 void  __attribute__((export_name("TS_CVec_PaymentPreimageZ_free"))) TS_CVec_PaymentPreimageZ_free(ptrArray _res) {
16083         LDKCVec_PaymentPreimageZ _res_constr;
16084         _res_constr.datalen = _res->arr_len;
16085         if (_res_constr.datalen > 0)
16086                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements");
16087         else
16088                 _res_constr.data = NULL;
16089         int8_tArray* _res_vals = (void*) _res->elems;
16090         for (size_t m = 0; m < _res_constr.datalen; m++) {
16091                 int8_tArray _res_conv_12 = _res_vals[m];
16092                 LDKThirtyTwoBytes _res_conv_12_ref;
16093                 CHECK(_res_conv_12->arr_len == 32);
16094                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
16095                 _res_constr.data[m] = _res_conv_12_ref;
16096         }
16097         FREE(_res);
16098         CVec_PaymentPreimageZ_free(_res_constr);
16099 }
16100
16101 static inline uint64_t C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR arg) {
16102         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16103         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(arg);
16104         return tag_ptr(ret_conv, true);
16105 }
16106 int64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(uint64_t arg) {
16107         LDKC2Tuple_SignatureCVec_SignatureZZ* arg_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(arg);
16108         int64_t ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(arg_conv);
16109         return ret_conv;
16110 }
16111
16112 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_clone"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint64_t orig) {
16113         LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(orig);
16114         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16115         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
16116         return tag_ptr(ret_conv, true);
16117 }
16118
16119 uint64_t  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_new"))) TS_C2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
16120         LDKSignature a_ref;
16121         CHECK(a->arr_len == 64);
16122         memcpy(a_ref.compact_form, a->elems, 64); FREE(a);
16123         LDKCVec_SignatureZ b_constr;
16124         b_constr.datalen = b->arr_len;
16125         if (b_constr.datalen > 0)
16126                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
16127         else
16128                 b_constr.data = NULL;
16129         int8_tArray* b_vals = (void*) b->elems;
16130         for (size_t m = 0; m < b_constr.datalen; m++) {
16131                 int8_tArray b_conv_12 = b_vals[m];
16132                 LDKSignature b_conv_12_ref;
16133                 CHECK(b_conv_12->arr_len == 64);
16134                 memcpy(b_conv_12_ref.compact_form, b_conv_12->elems, 64); FREE(b_conv_12);
16135                 b_constr.data[m] = b_conv_12_ref;
16136         }
16137         FREE(b);
16138         LDKC2Tuple_SignatureCVec_SignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
16139         *ret_conv = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
16140         return tag_ptr(ret_conv, true);
16141 }
16142
16143 void  __attribute__((export_name("TS_C2Tuple_SignatureCVec_SignatureZZ_free"))) TS_C2Tuple_SignatureCVec_SignatureZZ_free(uint64_t _res) {
16144         if (!ptr_is_owned(_res)) return;
16145         void* _res_ptr = untag_ptr(_res);
16146         CHECK_ACCESS(_res_ptr);
16147         LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(_res_ptr);
16148         FREE(untag_ptr(_res));
16149         C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
16150 }
16151
16152 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint64_t o) {
16153         void* o_ptr = untag_ptr(o);
16154         CHECK_ACCESS(o_ptr);
16155         LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(o_ptr);
16156         o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)untag_ptr(o));
16157         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16158         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
16159         return tag_ptr(ret_conv, true);
16160 }
16161
16162 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err() {
16163         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16164         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
16165         return tag_ptr(ret_conv, true);
16166 }
16167
16168 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(uint64_t o) {
16169         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(o);
16170         jboolean ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(o_conv);
16171         return ret_conv;
16172 }
16173
16174 void  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(uint64_t _res) {
16175         if (!ptr_is_owned(_res)) return;
16176         void* _res_ptr = untag_ptr(_res);
16177         CHECK_ACCESS(_res_ptr);
16178         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(_res_ptr);
16179         FREE(untag_ptr(_res));
16180         CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
16181 }
16182
16183 static inline uint64_t CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR arg) {
16184         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16185         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(arg);
16186         return tag_ptr(ret_conv, true);
16187 }
16188 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(uint64_t arg) {
16189         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(arg);
16190         int64_t ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(arg_conv);
16191         return ret_conv;
16192 }
16193
16194 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(uint64_t orig) {
16195         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)untag_ptr(orig);
16196         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
16197         *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
16198         return tag_ptr(ret_conv, true);
16199 }
16200
16201 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_ok"))) TS_CResult_SignatureNoneZ_ok(int8_tArray o) {
16202         LDKSignature o_ref;
16203         CHECK(o->arr_len == 64);
16204         memcpy(o_ref.compact_form, o->elems, 64); FREE(o);
16205         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16206         *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
16207         return tag_ptr(ret_conv, true);
16208 }
16209
16210 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_err"))) TS_CResult_SignatureNoneZ_err() {
16211         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16212         *ret_conv = CResult_SignatureNoneZ_err();
16213         return tag_ptr(ret_conv, true);
16214 }
16215
16216 jboolean  __attribute__((export_name("TS_CResult_SignatureNoneZ_is_ok"))) TS_CResult_SignatureNoneZ_is_ok(uint64_t o) {
16217         LDKCResult_SignatureNoneZ* o_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(o);
16218         jboolean ret_conv = CResult_SignatureNoneZ_is_ok(o_conv);
16219         return ret_conv;
16220 }
16221
16222 void  __attribute__((export_name("TS_CResult_SignatureNoneZ_free"))) TS_CResult_SignatureNoneZ_free(uint64_t _res) {
16223         if (!ptr_is_owned(_res)) return;
16224         void* _res_ptr = untag_ptr(_res);
16225         CHECK_ACCESS(_res_ptr);
16226         LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(_res_ptr);
16227         FREE(untag_ptr(_res));
16228         CResult_SignatureNoneZ_free(_res_conv);
16229 }
16230
16231 static inline uint64_t CResult_SignatureNoneZ_clone_ptr(LDKCResult_SignatureNoneZ *NONNULL_PTR arg) {
16232         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16233         *ret_conv = CResult_SignatureNoneZ_clone(arg);
16234         return tag_ptr(ret_conv, true);
16235 }
16236 int64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone_ptr"))) TS_CResult_SignatureNoneZ_clone_ptr(uint64_t arg) {
16237         LDKCResult_SignatureNoneZ* arg_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(arg);
16238         int64_t ret_conv = CResult_SignatureNoneZ_clone_ptr(arg_conv);
16239         return ret_conv;
16240 }
16241
16242 uint64_t  __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CResult_SignatureNoneZ_clone(uint64_t orig) {
16243         LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)untag_ptr(orig);
16244         LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
16245         *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
16246         return tag_ptr(ret_conv, true);
16247 }
16248
16249 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) {
16250         LDKPublicKey o_ref;
16251         CHECK(o->arr_len == 33);
16252         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
16253         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16254         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
16255         return tag_ptr(ret_conv, true);
16256 }
16257
16258 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_err"))) TS_CResult_PublicKeyNoneZ_err() {
16259         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16260         *ret_conv = CResult_PublicKeyNoneZ_err();
16261         return tag_ptr(ret_conv, true);
16262 }
16263
16264 jboolean  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_is_ok"))) TS_CResult_PublicKeyNoneZ_is_ok(uint64_t o) {
16265         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
16266         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
16267         return ret_conv;
16268 }
16269
16270 void  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_free"))) TS_CResult_PublicKeyNoneZ_free(uint64_t _res) {
16271         if (!ptr_is_owned(_res)) return;
16272         void* _res_ptr = untag_ptr(_res);
16273         CHECK_ACCESS(_res_ptr);
16274         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
16275         FREE(untag_ptr(_res));
16276         CResult_PublicKeyNoneZ_free(_res_conv);
16277 }
16278
16279 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
16280         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16281         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
16282         return tag_ptr(ret_conv, true);
16283 }
16284 int64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone_ptr"))) TS_CResult_PublicKeyNoneZ_clone_ptr(uint64_t arg) {
16285         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
16286         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
16287         return ret_conv;
16288 }
16289
16290 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyNoneZ_clone"))) TS_CResult_PublicKeyNoneZ_clone(uint64_t orig) {
16291         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
16292         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
16293         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
16294         return tag_ptr(ret_conv, true);
16295 }
16296
16297 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_some"))) TS_COption_ScalarZ_some(uint64_t o) {
16298         void* o_ptr = untag_ptr(o);
16299         CHECK_ACCESS(o_ptr);
16300         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
16301         // WARNING: we may need a move here but no clone is available for LDKBigEndianScalar
16302         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16303         *ret_copy = COption_ScalarZ_some(o_conv);
16304         uint64_t ret_ref = tag_ptr(ret_copy, true);
16305         return ret_ref;
16306 }
16307
16308 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_none"))) TS_COption_ScalarZ_none() {
16309         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16310         *ret_copy = COption_ScalarZ_none();
16311         uint64_t ret_ref = tag_ptr(ret_copy, true);
16312         return ret_ref;
16313 }
16314
16315 void  __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ_free(uint64_t _res) {
16316         if (!ptr_is_owned(_res)) return;
16317         void* _res_ptr = untag_ptr(_res);
16318         CHECK_ACCESS(_res_ptr);
16319         LDKCOption_ScalarZ _res_conv = *(LDKCOption_ScalarZ*)(_res_ptr);
16320         FREE(untag_ptr(_res));
16321         COption_ScalarZ_free(_res_conv);
16322 }
16323
16324 static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) {
16325         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16326         *ret_copy = COption_ScalarZ_clone(arg);
16327         uint64_t ret_ref = tag_ptr(ret_copy, true);
16328         return ret_ref;
16329 }
16330 int64_t  __attribute__((export_name("TS_COption_ScalarZ_clone_ptr"))) TS_COption_ScalarZ_clone_ptr(uint64_t arg) {
16331         LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg);
16332         int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv);
16333         return ret_conv;
16334 }
16335
16336 uint64_t  __attribute__((export_name("TS_COption_ScalarZ_clone"))) TS_COption_ScalarZ_clone(uint64_t orig) {
16337         LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig);
16338         LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ");
16339         *ret_copy = COption_ScalarZ_clone(orig_conv);
16340         uint64_t ret_ref = tag_ptr(ret_copy, true);
16341         return ret_ref;
16342 }
16343
16344 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) {
16345         LDKThirtyTwoBytes o_ref;
16346         CHECK(o->arr_len == 32);
16347         memcpy(o_ref.data, o->elems, 32); FREE(o);
16348         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16349         *ret_conv = CResult_SharedSecretNoneZ_ok(o_ref);
16350         return tag_ptr(ret_conv, true);
16351 }
16352
16353 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_err"))) TS_CResult_SharedSecretNoneZ_err() {
16354         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16355         *ret_conv = CResult_SharedSecretNoneZ_err();
16356         return tag_ptr(ret_conv, true);
16357 }
16358
16359 jboolean  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_is_ok"))) TS_CResult_SharedSecretNoneZ_is_ok(uint64_t o) {
16360         LDKCResult_SharedSecretNoneZ* o_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(o);
16361         jboolean ret_conv = CResult_SharedSecretNoneZ_is_ok(o_conv);
16362         return ret_conv;
16363 }
16364
16365 void  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_free"))) TS_CResult_SharedSecretNoneZ_free(uint64_t _res) {
16366         if (!ptr_is_owned(_res)) return;
16367         void* _res_ptr = untag_ptr(_res);
16368         CHECK_ACCESS(_res_ptr);
16369         LDKCResult_SharedSecretNoneZ _res_conv = *(LDKCResult_SharedSecretNoneZ*)(_res_ptr);
16370         FREE(untag_ptr(_res));
16371         CResult_SharedSecretNoneZ_free(_res_conv);
16372 }
16373
16374 static inline uint64_t CResult_SharedSecretNoneZ_clone_ptr(LDKCResult_SharedSecretNoneZ *NONNULL_PTR arg) {
16375         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16376         *ret_conv = CResult_SharedSecretNoneZ_clone(arg);
16377         return tag_ptr(ret_conv, true);
16378 }
16379 int64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone_ptr"))) TS_CResult_SharedSecretNoneZ_clone_ptr(uint64_t arg) {
16380         LDKCResult_SharedSecretNoneZ* arg_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(arg);
16381         int64_t ret_conv = CResult_SharedSecretNoneZ_clone_ptr(arg_conv);
16382         return ret_conv;
16383 }
16384
16385 uint64_t  __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_CResult_SharedSecretNoneZ_clone(uint64_t orig) {
16386         LDKCResult_SharedSecretNoneZ* orig_conv = (LDKCResult_SharedSecretNoneZ*)untag_ptr(orig);
16387         LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ");
16388         *ret_conv = CResult_SharedSecretNoneZ_clone(orig_conv);
16389         return tag_ptr(ret_conv, true);
16390 }
16391
16392 void  __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) {
16393         LDKCVec_U5Z _res_constr;
16394         _res_constr.datalen = _res->arr_len;
16395         if (_res_constr.datalen > 0)
16396                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
16397         else
16398                 _res_constr.data = NULL;
16399         int8_t* _res_vals = (void*) _res->elems;
16400         for (size_t h = 0; h < _res_constr.datalen; h++) {
16401                 int8_t _res_conv_7 = _res_vals[h];
16402                 
16403                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
16404         }
16405         FREE(_res);
16406         CVec_U5Z_free(_res_constr);
16407 }
16408
16409 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) {
16410         LDKRecoverableSignature o_ref;
16411         CHECK(o->arr_len == 68);
16412         memcpy(o_ref.serialized_form, o->elems, 68); FREE(o);
16413         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16414         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
16415         return tag_ptr(ret_conv, true);
16416 }
16417
16418 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_err"))) TS_CResult_RecoverableSignatureNoneZ_err() {
16419         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16420         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
16421         return tag_ptr(ret_conv, true);
16422 }
16423
16424 jboolean  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_is_ok"))) TS_CResult_RecoverableSignatureNoneZ_is_ok(uint64_t o) {
16425         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
16426         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
16427         return ret_conv;
16428 }
16429
16430 void  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_free"))) TS_CResult_RecoverableSignatureNoneZ_free(uint64_t _res) {
16431         if (!ptr_is_owned(_res)) return;
16432         void* _res_ptr = untag_ptr(_res);
16433         CHECK_ACCESS(_res_ptr);
16434         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
16435         FREE(untag_ptr(_res));
16436         CResult_RecoverableSignatureNoneZ_free(_res_conv);
16437 }
16438
16439 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
16440         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16441         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
16442         return tag_ptr(ret_conv, true);
16443 }
16444 int64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone_ptr"))) TS_CResult_RecoverableSignatureNoneZ_clone_ptr(uint64_t arg) {
16445         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
16446         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
16447         return ret_conv;
16448 }
16449
16450 uint64_t  __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone"))) TS_CResult_RecoverableSignatureNoneZ_clone(uint64_t orig) {
16451         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
16452         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
16453         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
16454         return tag_ptr(ret_conv, true);
16455 }
16456
16457 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) {
16458         void* o_ptr = untag_ptr(o);
16459         CHECK_ACCESS(o_ptr);
16460         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
16461         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
16462                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16463                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
16464         }
16465         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16466         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
16467         return tag_ptr(ret_conv, true);
16468 }
16469
16470 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(uint64_t e) {
16471         void* e_ptr = untag_ptr(e);
16472         CHECK_ACCESS(e_ptr);
16473         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16474         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16475         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16476         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
16477         return tag_ptr(ret_conv, true);
16478 }
16479
16480 jboolean  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) {
16481         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
16482         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
16483         return ret_conv;
16484 }
16485
16486 void  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) {
16487         if (!ptr_is_owned(_res)) return;
16488         void* _res_ptr = untag_ptr(_res);
16489         CHECK_ACCESS(_res_ptr);
16490         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
16491         FREE(untag_ptr(_res));
16492         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
16493 }
16494
16495 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
16496         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16497         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
16498         return tag_ptr(ret_conv, true);
16499 }
16500 int64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16501         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
16502         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
16503         return ret_conv;
16504 }
16505
16506 uint64_t  __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) {
16507         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
16508         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
16509         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
16510         return tag_ptr(ret_conv, true);
16511 }
16512
16513 uint64_t  __attribute__((export_name("TS_CResult_ScriptNoneZ_ok"))) TS_CResult_ScriptNoneZ_ok(int8_tArray o) {
16514         LDKCVec_u8Z o_ref;
16515         o_ref.datalen = o->arr_len;
16516         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16517         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16518         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
16519         *ret_conv = CResult_ScriptNoneZ_ok(o_ref);
16520         return tag_ptr(ret_conv, true);
16521 }
16522
16523 uint64_t  __attribute__((export_name("TS_CResult_ScriptNoneZ_err"))) TS_CResult_ScriptNoneZ_err() {
16524         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
16525         *ret_conv = CResult_ScriptNoneZ_err();
16526         return tag_ptr(ret_conv, true);
16527 }
16528
16529 jboolean  __attribute__((export_name("TS_CResult_ScriptNoneZ_is_ok"))) TS_CResult_ScriptNoneZ_is_ok(uint64_t o) {
16530         LDKCResult_ScriptNoneZ* o_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(o);
16531         jboolean ret_conv = CResult_ScriptNoneZ_is_ok(o_conv);
16532         return ret_conv;
16533 }
16534
16535 void  __attribute__((export_name("TS_CResult_ScriptNoneZ_free"))) TS_CResult_ScriptNoneZ_free(uint64_t _res) {
16536         if (!ptr_is_owned(_res)) return;
16537         void* _res_ptr = untag_ptr(_res);
16538         CHECK_ACCESS(_res_ptr);
16539         LDKCResult_ScriptNoneZ _res_conv = *(LDKCResult_ScriptNoneZ*)(_res_ptr);
16540         FREE(untag_ptr(_res));
16541         CResult_ScriptNoneZ_free(_res_conv);
16542 }
16543
16544 static inline uint64_t CResult_ScriptNoneZ_clone_ptr(LDKCResult_ScriptNoneZ *NONNULL_PTR arg) {
16545         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
16546         *ret_conv = CResult_ScriptNoneZ_clone(arg);
16547         return tag_ptr(ret_conv, true);
16548 }
16549 int64_t  __attribute__((export_name("TS_CResult_ScriptNoneZ_clone_ptr"))) TS_CResult_ScriptNoneZ_clone_ptr(uint64_t arg) {
16550         LDKCResult_ScriptNoneZ* arg_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(arg);
16551         int64_t ret_conv = CResult_ScriptNoneZ_clone_ptr(arg_conv);
16552         return ret_conv;
16553 }
16554
16555 uint64_t  __attribute__((export_name("TS_CResult_ScriptNoneZ_clone"))) TS_CResult_ScriptNoneZ_clone(uint64_t orig) {
16556         LDKCResult_ScriptNoneZ* orig_conv = (LDKCResult_ScriptNoneZ*)untag_ptr(orig);
16557         LDKCResult_ScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ScriptNoneZ), "LDKCResult_ScriptNoneZ");
16558         *ret_conv = CResult_ScriptNoneZ_clone(orig_conv);
16559         return tag_ptr(ret_conv, true);
16560 }
16561
16562 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_ok"))) TS_CResult_ShutdownScriptNoneZ_ok(uint64_t o) {
16563         LDKShutdownScript o_conv;
16564         o_conv.inner = untag_ptr(o);
16565         o_conv.is_owned = ptr_is_owned(o);
16566         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16567         o_conv = ShutdownScript_clone(&o_conv);
16568         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16569         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
16570         return tag_ptr(ret_conv, true);
16571 }
16572
16573 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_err"))) TS_CResult_ShutdownScriptNoneZ_err() {
16574         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16575         *ret_conv = CResult_ShutdownScriptNoneZ_err();
16576         return tag_ptr(ret_conv, true);
16577 }
16578
16579 jboolean  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_is_ok"))) TS_CResult_ShutdownScriptNoneZ_is_ok(uint64_t o) {
16580         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
16581         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
16582         return ret_conv;
16583 }
16584
16585 void  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_free"))) TS_CResult_ShutdownScriptNoneZ_free(uint64_t _res) {
16586         if (!ptr_is_owned(_res)) return;
16587         void* _res_ptr = untag_ptr(_res);
16588         CHECK_ACCESS(_res_ptr);
16589         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
16590         FREE(untag_ptr(_res));
16591         CResult_ShutdownScriptNoneZ_free(_res_conv);
16592 }
16593
16594 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
16595         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16596         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
16597         return tag_ptr(ret_conv, true);
16598 }
16599 int64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone_ptr"))) TS_CResult_ShutdownScriptNoneZ_clone_ptr(uint64_t arg) {
16600         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
16601         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
16602         return ret_conv;
16603 }
16604
16605 uint64_t  __attribute__((export_name("TS_CResult_ShutdownScriptNoneZ_clone"))) TS_CResult_ShutdownScriptNoneZ_clone(uint64_t orig) {
16606         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
16607         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
16608         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
16609         return tag_ptr(ret_conv, true);
16610 }
16611
16612 void  __attribute__((export_name("TS_CVec_CVec_u8ZZ_free"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) {
16613         LDKCVec_CVec_u8ZZ _res_constr;
16614         _res_constr.datalen = _res->arr_len;
16615         if (_res_constr.datalen > 0)
16616                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16617         else
16618                 _res_constr.data = NULL;
16619         int8_tArray* _res_vals = (void*) _res->elems;
16620         for (size_t m = 0; m < _res_constr.datalen; m++) {
16621                 int8_tArray _res_conv_12 = _res_vals[m];
16622                 LDKCVec_u8Z _res_conv_12_ref;
16623                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
16624                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16625                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
16626                 _res_constr.data[m] = _res_conv_12_ref;
16627         }
16628         FREE(_res);
16629         CVec_CVec_u8ZZ_free(_res_constr);
16630 }
16631
16632 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) {
16633         LDKCVec_CVec_u8ZZ o_constr;
16634         o_constr.datalen = o->arr_len;
16635         if (o_constr.datalen > 0)
16636                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
16637         else
16638                 o_constr.data = NULL;
16639         int8_tArray* o_vals = (void*) o->elems;
16640         for (size_t m = 0; m < o_constr.datalen; m++) {
16641                 int8_tArray o_conv_12 = o_vals[m];
16642                 LDKCVec_u8Z o_conv_12_ref;
16643                 o_conv_12_ref.datalen = o_conv_12->arr_len;
16644                 o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes");
16645                 memcpy(o_conv_12_ref.data, o_conv_12->elems, o_conv_12_ref.datalen); FREE(o_conv_12);
16646                 o_constr.data[m] = o_conv_12_ref;
16647         }
16648         FREE(o);
16649         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16650         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
16651         return tag_ptr(ret_conv, true);
16652 }
16653
16654 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_err"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() {
16655         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16656         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
16657         return tag_ptr(ret_conv, true);
16658 }
16659
16660 jboolean  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok"))) TS_CResult_CVec_CVec_u8ZZNoneZ_is_ok(uint64_t o) {
16661         LDKCResult_CVec_CVec_u8ZZNoneZ* o_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(o);
16662         jboolean ret_conv = CResult_CVec_CVec_u8ZZNoneZ_is_ok(o_conv);
16663         return ret_conv;
16664 }
16665
16666 void  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_free"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint64_t _res) {
16667         if (!ptr_is_owned(_res)) return;
16668         void* _res_ptr = untag_ptr(_res);
16669         CHECK_ACCESS(_res_ptr);
16670         LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(_res_ptr);
16671         FREE(untag_ptr(_res));
16672         CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
16673 }
16674
16675 static inline uint64_t CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR arg) {
16676         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16677         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(arg);
16678         return tag_ptr(ret_conv, true);
16679 }
16680 int64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(uint64_t arg) {
16681         LDKCResult_CVec_CVec_u8ZZNoneZ* arg_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(arg);
16682         int64_t ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(arg_conv);
16683         return ret_conv;
16684 }
16685
16686 uint64_t  __attribute__((export_name("TS_CResult_CVec_CVec_u8ZZNoneZ_clone"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint64_t orig) {
16687         LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)untag_ptr(orig);
16688         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
16689         *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
16690         return tag_ptr(ret_conv, true);
16691 }
16692
16693 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint64_t o) {
16694         LDKInMemorySigner o_conv;
16695         o_conv.inner = untag_ptr(o);
16696         o_conv.is_owned = ptr_is_owned(o);
16697         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16698         o_conv = InMemorySigner_clone(&o_conv);
16699         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16700         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
16701         return tag_ptr(ret_conv, true);
16702 }
16703
16704 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_err"))) TS_CResult_InMemorySignerDecodeErrorZ_err(uint64_t e) {
16705         void* e_ptr = untag_ptr(e);
16706         CHECK_ACCESS(e_ptr);
16707         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16708         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16709         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16710         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
16711         return tag_ptr(ret_conv, true);
16712 }
16713
16714 jboolean  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_is_ok"))) TS_CResult_InMemorySignerDecodeErrorZ_is_ok(uint64_t o) {
16715         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
16716         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
16717         return ret_conv;
16718 }
16719
16720 void  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_free"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint64_t _res) {
16721         if (!ptr_is_owned(_res)) return;
16722         void* _res_ptr = untag_ptr(_res);
16723         CHECK_ACCESS(_res_ptr);
16724         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
16725         FREE(untag_ptr(_res));
16726         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
16727 }
16728
16729 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
16730         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16731         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
16732         return tag_ptr(ret_conv, true);
16733 }
16734 int64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr"))) TS_CResult_InMemorySignerDecodeErrorZ_clone_ptr(uint64_t arg) {
16735         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
16736         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
16737         return ret_conv;
16738 }
16739
16740 uint64_t  __attribute__((export_name("TS_CResult_InMemorySignerDecodeErrorZ_clone"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint64_t orig) {
16741         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
16742         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
16743         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
16744         return tag_ptr(ret_conv, true);
16745 }
16746
16747 uint64_t  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_ok"))) TS_CResult_PartiallySignedTransactionNoneZ_ok(int8_tArray o) {
16748         LDKCVec_u8Z o_ref;
16749         o_ref.datalen = o->arr_len;
16750         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
16751         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16752         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
16753         *ret_conv = CResult_PartiallySignedTransactionNoneZ_ok(o_ref);
16754         return tag_ptr(ret_conv, true);
16755 }
16756
16757 uint64_t  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_err"))) TS_CResult_PartiallySignedTransactionNoneZ_err() {
16758         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
16759         *ret_conv = CResult_PartiallySignedTransactionNoneZ_err();
16760         return tag_ptr(ret_conv, true);
16761 }
16762
16763 jboolean  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_is_ok"))) TS_CResult_PartiallySignedTransactionNoneZ_is_ok(uint64_t o) {
16764         LDKCResult_PartiallySignedTransactionNoneZ* o_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(o);
16765         jboolean ret_conv = CResult_PartiallySignedTransactionNoneZ_is_ok(o_conv);
16766         return ret_conv;
16767 }
16768
16769 void  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_free"))) TS_CResult_PartiallySignedTransactionNoneZ_free(uint64_t _res) {
16770         if (!ptr_is_owned(_res)) return;
16771         void* _res_ptr = untag_ptr(_res);
16772         CHECK_ACCESS(_res_ptr);
16773         LDKCResult_PartiallySignedTransactionNoneZ _res_conv = *(LDKCResult_PartiallySignedTransactionNoneZ*)(_res_ptr);
16774         FREE(untag_ptr(_res));
16775         CResult_PartiallySignedTransactionNoneZ_free(_res_conv);
16776 }
16777
16778 static inline uint64_t CResult_PartiallySignedTransactionNoneZ_clone_ptr(LDKCResult_PartiallySignedTransactionNoneZ *NONNULL_PTR arg) {
16779         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
16780         *ret_conv = CResult_PartiallySignedTransactionNoneZ_clone(arg);
16781         return tag_ptr(ret_conv, true);
16782 }
16783 int64_t  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_clone_ptr"))) TS_CResult_PartiallySignedTransactionNoneZ_clone_ptr(uint64_t arg) {
16784         LDKCResult_PartiallySignedTransactionNoneZ* arg_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(arg);
16785         int64_t ret_conv = CResult_PartiallySignedTransactionNoneZ_clone_ptr(arg_conv);
16786         return ret_conv;
16787 }
16788
16789 uint64_t  __attribute__((export_name("TS_CResult_PartiallySignedTransactionNoneZ_clone"))) TS_CResult_PartiallySignedTransactionNoneZ_clone(uint64_t orig) {
16790         LDKCResult_PartiallySignedTransactionNoneZ* orig_conv = (LDKCResult_PartiallySignedTransactionNoneZ*)untag_ptr(orig);
16791         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
16792         *ret_conv = CResult_PartiallySignedTransactionNoneZ_clone(orig_conv);
16793         return tag_ptr(ret_conv, true);
16794 }
16795
16796 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_ok"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) {
16797         LDKTransaction o_ref;
16798         o_ref.datalen = o->arr_len;
16799         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
16800         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
16801         o_ref.data_is_owned = true;
16802         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16803         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
16804         return tag_ptr(ret_conv, true);
16805 }
16806
16807 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_err"))) TS_CResult_TransactionNoneZ_err() {
16808         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16809         *ret_conv = CResult_TransactionNoneZ_err();
16810         return tag_ptr(ret_conv, true);
16811 }
16812
16813 jboolean  __attribute__((export_name("TS_CResult_TransactionNoneZ_is_ok"))) TS_CResult_TransactionNoneZ_is_ok(uint64_t o) {
16814         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
16815         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
16816         return ret_conv;
16817 }
16818
16819 void  __attribute__((export_name("TS_CResult_TransactionNoneZ_free"))) TS_CResult_TransactionNoneZ_free(uint64_t _res) {
16820         if (!ptr_is_owned(_res)) return;
16821         void* _res_ptr = untag_ptr(_res);
16822         CHECK_ACCESS(_res_ptr);
16823         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
16824         FREE(untag_ptr(_res));
16825         CResult_TransactionNoneZ_free(_res_conv);
16826 }
16827
16828 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
16829         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16830         *ret_conv = CResult_TransactionNoneZ_clone(arg);
16831         return tag_ptr(ret_conv, true);
16832 }
16833 int64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone_ptr"))) TS_CResult_TransactionNoneZ_clone_ptr(uint64_t arg) {
16834         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
16835         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
16836         return ret_conv;
16837 }
16838
16839 uint64_t  __attribute__((export_name("TS_CResult_TransactionNoneZ_clone"))) TS_CResult_TransactionNoneZ_clone(uint64_t orig) {
16840         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
16841         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
16842         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
16843         return tag_ptr(ret_conv, true);
16844 }
16845
16846 void  __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) {
16847         LDKCVec_ChannelDetailsZ _res_constr;
16848         _res_constr.datalen = _res->arr_len;
16849         if (_res_constr.datalen > 0)
16850                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16851         else
16852                 _res_constr.data = NULL;
16853         uint64_t* _res_vals = _res->elems;
16854         for (size_t q = 0; q < _res_constr.datalen; q++) {
16855                 uint64_t _res_conv_16 = _res_vals[q];
16856                 LDKChannelDetails _res_conv_16_conv;
16857                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
16858                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
16859                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
16860                 _res_constr.data[q] = _res_conv_16_conv;
16861         }
16862         FREE(_res);
16863         CVec_ChannelDetailsZ_free(_res_constr);
16864 }
16865
16866 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) {
16867         LDKRoute o_conv;
16868         o_conv.inner = untag_ptr(o);
16869         o_conv.is_owned = ptr_is_owned(o);
16870         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16871         o_conv = Route_clone(&o_conv);
16872         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16873         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
16874         return tag_ptr(ret_conv, true);
16875 }
16876
16877 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) {
16878         LDKLightningError e_conv;
16879         e_conv.inner = untag_ptr(e);
16880         e_conv.is_owned = ptr_is_owned(e);
16881         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
16882         e_conv = LightningError_clone(&e_conv);
16883         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16884         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
16885         return tag_ptr(ret_conv, true);
16886 }
16887
16888 jboolean  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) {
16889         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
16890         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
16891         return ret_conv;
16892 }
16893
16894 void  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) {
16895         if (!ptr_is_owned(_res)) return;
16896         void* _res_ptr = untag_ptr(_res);
16897         CHECK_ACCESS(_res_ptr);
16898         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
16899         FREE(untag_ptr(_res));
16900         CResult_RouteLightningErrorZ_free(_res_conv);
16901 }
16902
16903 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
16904         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16905         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
16906         return tag_ptr(ret_conv, true);
16907 }
16908 int64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) {
16909         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
16910         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
16911         return ret_conv;
16912 }
16913
16914 uint64_t  __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) {
16915         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
16916         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16917         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
16918         return tag_ptr(ret_conv, true);
16919 }
16920
16921 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) {
16922         LDKInFlightHtlcs o_conv;
16923         o_conv.inner = untag_ptr(o);
16924         o_conv.is_owned = ptr_is_owned(o);
16925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16926         o_conv = InFlightHtlcs_clone(&o_conv);
16927         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16928         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
16929         return tag_ptr(ret_conv, true);
16930 }
16931
16932 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) {
16933         void* e_ptr = untag_ptr(e);
16934         CHECK_ACCESS(e_ptr);
16935         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16936         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16937         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16938         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
16939         return tag_ptr(ret_conv, true);
16940 }
16941
16942 jboolean  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) {
16943         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
16944         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
16945         return ret_conv;
16946 }
16947
16948 void  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) {
16949         if (!ptr_is_owned(_res)) return;
16950         void* _res_ptr = untag_ptr(_res);
16951         CHECK_ACCESS(_res_ptr);
16952         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
16953         FREE(untag_ptr(_res));
16954         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
16955 }
16956
16957 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
16958         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16959         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
16960         return tag_ptr(ret_conv, true);
16961 }
16962 int64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) {
16963         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
16964         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
16965         return ret_conv;
16966 }
16967
16968 uint64_t  __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) {
16969         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
16970         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
16971         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
16972         return tag_ptr(ret_conv, true);
16973 }
16974
16975 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) {
16976         LDKRouteHop o_conv;
16977         o_conv.inner = untag_ptr(o);
16978         o_conv.is_owned = ptr_is_owned(o);
16979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
16980         o_conv = RouteHop_clone(&o_conv);
16981         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
16982         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
16983         return tag_ptr(ret_conv, true);
16984 }
16985
16986 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) {
16987         void* e_ptr = untag_ptr(e);
16988         CHECK_ACCESS(e_ptr);
16989         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
16990         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
16991         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
16992         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
16993         return tag_ptr(ret_conv, true);
16994 }
16995
16996 jboolean  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) {
16997         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
16998         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
16999         return ret_conv;
17000 }
17001
17002 void  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) {
17003         if (!ptr_is_owned(_res)) return;
17004         void* _res_ptr = untag_ptr(_res);
17005         CHECK_ACCESS(_res_ptr);
17006         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
17007         FREE(untag_ptr(_res));
17008         CResult_RouteHopDecodeErrorZ_free(_res_conv);
17009 }
17010
17011 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
17012         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17013         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
17014         return tag_ptr(ret_conv, true);
17015 }
17016 int64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17017         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
17018         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
17019         return ret_conv;
17020 }
17021
17022 uint64_t  __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) {
17023         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
17024         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
17025         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
17026         return tag_ptr(ret_conv, true);
17027 }
17028
17029 void  __attribute__((export_name("TS_CVec_BlindedHopZ_free"))) TS_CVec_BlindedHopZ_free(uint64_tArray _res) {
17030         LDKCVec_BlindedHopZ _res_constr;
17031         _res_constr.datalen = _res->arr_len;
17032         if (_res_constr.datalen > 0)
17033                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
17034         else
17035                 _res_constr.data = NULL;
17036         uint64_t* _res_vals = _res->elems;
17037         for (size_t m = 0; m < _res_constr.datalen; m++) {
17038                 uint64_t _res_conv_12 = _res_vals[m];
17039                 LDKBlindedHop _res_conv_12_conv;
17040                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
17041                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
17042                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
17043                 _res_constr.data[m] = _res_conv_12_conv;
17044         }
17045         FREE(_res);
17046         CVec_BlindedHopZ_free(_res_constr);
17047 }
17048
17049 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_ok"))) TS_CResult_BlindedTailDecodeErrorZ_ok(uint64_t o) {
17050         LDKBlindedTail o_conv;
17051         o_conv.inner = untag_ptr(o);
17052         o_conv.is_owned = ptr_is_owned(o);
17053         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17054         o_conv = BlindedTail_clone(&o_conv);
17055         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17056         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
17057         return tag_ptr(ret_conv, true);
17058 }
17059
17060 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_err"))) TS_CResult_BlindedTailDecodeErrorZ_err(uint64_t e) {
17061         void* e_ptr = untag_ptr(e);
17062         CHECK_ACCESS(e_ptr);
17063         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17064         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17065         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17066         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
17067         return tag_ptr(ret_conv, true);
17068 }
17069
17070 jboolean  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_is_ok"))) TS_CResult_BlindedTailDecodeErrorZ_is_ok(uint64_t o) {
17071         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
17072         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
17073         return ret_conv;
17074 }
17075
17076 void  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_free"))) TS_CResult_BlindedTailDecodeErrorZ_free(uint64_t _res) {
17077         if (!ptr_is_owned(_res)) return;
17078         void* _res_ptr = untag_ptr(_res);
17079         CHECK_ACCESS(_res_ptr);
17080         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
17081         FREE(untag_ptr(_res));
17082         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
17083 }
17084
17085 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
17086         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17087         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
17088         return tag_ptr(ret_conv, true);
17089 }
17090 int64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedTailDecodeErrorZ_clone_ptr(uint64_t arg) {
17091         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
17092         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
17093         return ret_conv;
17094 }
17095
17096 uint64_t  __attribute__((export_name("TS_CResult_BlindedTailDecodeErrorZ_clone"))) TS_CResult_BlindedTailDecodeErrorZ_clone(uint64_t orig) {
17097         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
17098         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
17099         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
17100         return tag_ptr(ret_conv, true);
17101 }
17102
17103 void  __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) {
17104         LDKCVec_RouteHopZ _res_constr;
17105         _res_constr.datalen = _res->arr_len;
17106         if (_res_constr.datalen > 0)
17107                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
17108         else
17109                 _res_constr.data = NULL;
17110         uint64_t* _res_vals = _res->elems;
17111         for (size_t k = 0; k < _res_constr.datalen; k++) {
17112                 uint64_t _res_conv_10 = _res_vals[k];
17113                 LDKRouteHop _res_conv_10_conv;
17114                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
17115                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
17116                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
17117                 _res_constr.data[k] = _res_conv_10_conv;
17118         }
17119         FREE(_res);
17120         CVec_RouteHopZ_free(_res_constr);
17121 }
17122
17123 void  __attribute__((export_name("TS_CVec_PathZ_free"))) TS_CVec_PathZ_free(uint64_tArray _res) {
17124         LDKCVec_PathZ _res_constr;
17125         _res_constr.datalen = _res->arr_len;
17126         if (_res_constr.datalen > 0)
17127                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
17128         else
17129                 _res_constr.data = NULL;
17130         uint64_t* _res_vals = _res->elems;
17131         for (size_t g = 0; g < _res_constr.datalen; g++) {
17132                 uint64_t _res_conv_6 = _res_vals[g];
17133                 LDKPath _res_conv_6_conv;
17134                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
17135                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
17136                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
17137                 _res_constr.data[g] = _res_conv_6_conv;
17138         }
17139         FREE(_res);
17140         CVec_PathZ_free(_res_constr);
17141 }
17142
17143 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) {
17144         LDKRoute o_conv;
17145         o_conv.inner = untag_ptr(o);
17146         o_conv.is_owned = ptr_is_owned(o);
17147         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17148         o_conv = Route_clone(&o_conv);
17149         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17150         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
17151         return tag_ptr(ret_conv, true);
17152 }
17153
17154 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) {
17155         void* e_ptr = untag_ptr(e);
17156         CHECK_ACCESS(e_ptr);
17157         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17158         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17159         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17160         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
17161         return tag_ptr(ret_conv, true);
17162 }
17163
17164 jboolean  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) {
17165         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
17166         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
17167         return ret_conv;
17168 }
17169
17170 void  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) {
17171         if (!ptr_is_owned(_res)) return;
17172         void* _res_ptr = untag_ptr(_res);
17173         CHECK_ACCESS(_res_ptr);
17174         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
17175         FREE(untag_ptr(_res));
17176         CResult_RouteDecodeErrorZ_free(_res_conv);
17177 }
17178
17179 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
17180         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17181         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
17182         return tag_ptr(ret_conv, true);
17183 }
17184 int64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) {
17185         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
17186         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
17187         return ret_conv;
17188 }
17189
17190 uint64_t  __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) {
17191         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
17192         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
17193         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
17194         return tag_ptr(ret_conv, true);
17195 }
17196
17197 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) {
17198         LDKRouteParameters o_conv;
17199         o_conv.inner = untag_ptr(o);
17200         o_conv.is_owned = ptr_is_owned(o);
17201         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17202         o_conv = RouteParameters_clone(&o_conv);
17203         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17204         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
17205         return tag_ptr(ret_conv, true);
17206 }
17207
17208 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) {
17209         void* e_ptr = untag_ptr(e);
17210         CHECK_ACCESS(e_ptr);
17211         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17212         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17213         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17214         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
17215         return tag_ptr(ret_conv, true);
17216 }
17217
17218 jboolean  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) {
17219         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
17220         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
17221         return ret_conv;
17222 }
17223
17224 void  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) {
17225         if (!ptr_is_owned(_res)) return;
17226         void* _res_ptr = untag_ptr(_res);
17227         CHECK_ACCESS(_res_ptr);
17228         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
17229         FREE(untag_ptr(_res));
17230         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
17231 }
17232
17233 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
17234         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17235         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
17236         return tag_ptr(ret_conv, true);
17237 }
17238 int64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17239         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
17240         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
17241         return ret_conv;
17242 }
17243
17244 uint64_t  __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) {
17245         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
17246         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
17247         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
17248         return tag_ptr(ret_conv, true);
17249 }
17250
17251 void  __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) {
17252         LDKCVec_u64Z _res_constr;
17253         _res_constr.datalen = _res->arr_len;
17254         if (_res_constr.datalen > 0)
17255                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17256         else
17257                 _res_constr.data = NULL;
17258         int64_t* _res_vals = _res->elems;
17259         for (size_t i = 0; i < _res_constr.datalen; i++) {
17260                 int64_t _res_conv_8 = _res_vals[i];
17261                 _res_constr.data[i] = _res_conv_8;
17262         }
17263         FREE(_res);
17264         CVec_u64Z_free(_res_constr);
17265 }
17266
17267 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_ok(uint64_t o) {
17268         LDKPaymentParameters o_conv;
17269         o_conv.inner = untag_ptr(o);
17270         o_conv.is_owned = ptr_is_owned(o);
17271         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17272         o_conv = PaymentParameters_clone(&o_conv);
17273         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17274         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
17275         return tag_ptr(ret_conv, true);
17276 }
17277
17278 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_err"))) TS_CResult_PaymentParametersDecodeErrorZ_err(uint64_t e) {
17279         void* e_ptr = untag_ptr(e);
17280         CHECK_ACCESS(e_ptr);
17281         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17282         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17283         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17284         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
17285         return tag_ptr(ret_conv, true);
17286 }
17287
17288 jboolean  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_is_ok"))) TS_CResult_PaymentParametersDecodeErrorZ_is_ok(uint64_t o) {
17289         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
17290         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
17291         return ret_conv;
17292 }
17293
17294 void  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_free"))) TS_CResult_PaymentParametersDecodeErrorZ_free(uint64_t _res) {
17295         if (!ptr_is_owned(_res)) return;
17296         void* _res_ptr = untag_ptr(_res);
17297         CHECK_ACCESS(_res_ptr);
17298         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
17299         FREE(untag_ptr(_res));
17300         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
17301 }
17302
17303 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
17304         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17305         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
17306         return tag_ptr(ret_conv, true);
17307 }
17308 int64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentParametersDecodeErrorZ_clone_ptr(uint64_t arg) {
17309         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
17310         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
17311         return ret_conv;
17312 }
17313
17314 uint64_t  __attribute__((export_name("TS_CResult_PaymentParametersDecodeErrorZ_clone"))) TS_CResult_PaymentParametersDecodeErrorZ_clone(uint64_t orig) {
17315         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
17316         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
17317         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
17318         return tag_ptr(ret_conv, true);
17319 }
17320
17321 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
17322         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17323         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
17324         return tag_ptr(ret_conv, true);
17325 }
17326 int64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(uint64_t arg) {
17327         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
17328         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
17329         return ret_conv;
17330 }
17331
17332 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_clone(uint64_t orig) {
17333         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
17334         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17335         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
17336         return tag_ptr(ret_conv, true);
17337 }
17338
17339 uint64_t  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_new"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_new(uint64_t a, uint64_t b) {
17340         LDKBlindedPayInfo a_conv;
17341         a_conv.inner = untag_ptr(a);
17342         a_conv.is_owned = ptr_is_owned(a);
17343         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17344         a_conv = BlindedPayInfo_clone(&a_conv);
17345         LDKBlindedPath b_conv;
17346         b_conv.inner = untag_ptr(b);
17347         b_conv.is_owned = ptr_is_owned(b);
17348         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
17349         b_conv = BlindedPath_clone(&b_conv);
17350         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
17351         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
17352         return tag_ptr(ret_conv, true);
17353 }
17354
17355 void  __attribute__((export_name("TS_C2Tuple_BlindedPayInfoBlindedPathZ_free"))) TS_C2Tuple_BlindedPayInfoBlindedPathZ_free(uint64_t _res) {
17356         if (!ptr_is_owned(_res)) return;
17357         void* _res_ptr = untag_ptr(_res);
17358         CHECK_ACCESS(_res_ptr);
17359         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
17360         FREE(untag_ptr(_res));
17361         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
17362 }
17363
17364 void  __attribute__((export_name("TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free"))) TS_CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(uint64_tArray _res) {
17365         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
17366         _res_constr.datalen = _res->arr_len;
17367         if (_res_constr.datalen > 0)
17368                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
17369         else
17370                 _res_constr.data = NULL;
17371         uint64_t* _res_vals = _res->elems;
17372         for (size_t l = 0; l < _res_constr.datalen; l++) {
17373                 uint64_t _res_conv_37 = _res_vals[l];
17374                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
17375                 CHECK_ACCESS(_res_conv_37_ptr);
17376                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
17377                 FREE(untag_ptr(_res_conv_37));
17378                 _res_constr.data[l] = _res_conv_37_conv;
17379         }
17380         FREE(_res);
17381         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
17382 }
17383
17384 void  __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) {
17385         LDKCVec_RouteHintZ _res_constr;
17386         _res_constr.datalen = _res->arr_len;
17387         if (_res_constr.datalen > 0)
17388                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
17389         else
17390                 _res_constr.data = NULL;
17391         uint64_t* _res_vals = _res->elems;
17392         for (size_t l = 0; l < _res_constr.datalen; l++) {
17393                 uint64_t _res_conv_11 = _res_vals[l];
17394                 LDKRouteHint _res_conv_11_conv;
17395                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
17396                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
17397                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
17398                 _res_constr.data[l] = _res_conv_11_conv;
17399         }
17400         FREE(_res);
17401         CVec_RouteHintZ_free(_res_constr);
17402 }
17403
17404 void  __attribute__((export_name("TS_CVec_RouteHintHopZ_free"))) TS_CVec_RouteHintHopZ_free(uint64_tArray _res) {
17405         LDKCVec_RouteHintHopZ _res_constr;
17406         _res_constr.datalen = _res->arr_len;
17407         if (_res_constr.datalen > 0)
17408                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
17409         else
17410                 _res_constr.data = NULL;
17411         uint64_t* _res_vals = _res->elems;
17412         for (size_t o = 0; o < _res_constr.datalen; o++) {
17413                 uint64_t _res_conv_14 = _res_vals[o];
17414                 LDKRouteHintHop _res_conv_14_conv;
17415                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
17416                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
17417                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
17418                 _res_constr.data[o] = _res_conv_14_conv;
17419         }
17420         FREE(_res);
17421         CVec_RouteHintHopZ_free(_res_constr);
17422 }
17423
17424 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_ok"))) TS_CResult_RouteHintDecodeErrorZ_ok(uint64_t o) {
17425         LDKRouteHint o_conv;
17426         o_conv.inner = untag_ptr(o);
17427         o_conv.is_owned = ptr_is_owned(o);
17428         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17429         o_conv = RouteHint_clone(&o_conv);
17430         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17431         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
17432         return tag_ptr(ret_conv, true);
17433 }
17434
17435 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_err"))) TS_CResult_RouteHintDecodeErrorZ_err(uint64_t e) {
17436         void* e_ptr = untag_ptr(e);
17437         CHECK_ACCESS(e_ptr);
17438         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17439         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17440         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17441         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
17442         return tag_ptr(ret_conv, true);
17443 }
17444
17445 jboolean  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_is_ok"))) TS_CResult_RouteHintDecodeErrorZ_is_ok(uint64_t o) {
17446         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
17447         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
17448         return ret_conv;
17449 }
17450
17451 void  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_free"))) TS_CResult_RouteHintDecodeErrorZ_free(uint64_t _res) {
17452         if (!ptr_is_owned(_res)) return;
17453         void* _res_ptr = untag_ptr(_res);
17454         CHECK_ACCESS(_res_ptr);
17455         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
17456         FREE(untag_ptr(_res));
17457         CResult_RouteHintDecodeErrorZ_free(_res_conv);
17458 }
17459
17460 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
17461         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17462         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
17463         return tag_ptr(ret_conv, true);
17464 }
17465 int64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintDecodeErrorZ_clone_ptr(uint64_t arg) {
17466         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
17467         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
17468         return ret_conv;
17469 }
17470
17471 uint64_t  __attribute__((export_name("TS_CResult_RouteHintDecodeErrorZ_clone"))) TS_CResult_RouteHintDecodeErrorZ_clone(uint64_t orig) {
17472         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
17473         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
17474         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
17475         return tag_ptr(ret_conv, true);
17476 }
17477
17478 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_ok(uint64_t o) {
17479         LDKRouteHintHop o_conv;
17480         o_conv.inner = untag_ptr(o);
17481         o_conv.is_owned = ptr_is_owned(o);
17482         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17483         o_conv = RouteHintHop_clone(&o_conv);
17484         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17485         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
17486         return tag_ptr(ret_conv, true);
17487 }
17488
17489 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_err"))) TS_CResult_RouteHintHopDecodeErrorZ_err(uint64_t e) {
17490         void* e_ptr = untag_ptr(e);
17491         CHECK_ACCESS(e_ptr);
17492         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17493         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17494         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17495         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
17496         return tag_ptr(ret_conv, true);
17497 }
17498
17499 jboolean  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHintHopDecodeErrorZ_is_ok(uint64_t o) {
17500         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
17501         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
17502         return ret_conv;
17503 }
17504
17505 void  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_free"))) TS_CResult_RouteHintHopDecodeErrorZ_free(uint64_t _res) {
17506         if (!ptr_is_owned(_res)) return;
17507         void* _res_ptr = untag_ptr(_res);
17508         CHECK_ACCESS(_res_ptr);
17509         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
17510         FREE(untag_ptr(_res));
17511         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
17512 }
17513
17514 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
17515         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17516         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
17517         return tag_ptr(ret_conv, true);
17518 }
17519 int64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHintHopDecodeErrorZ_clone_ptr(uint64_t arg) {
17520         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
17521         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
17522         return ret_conv;
17523 }
17524
17525 uint64_t  __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone"))) TS_CResult_RouteHintHopDecodeErrorZ_clone(uint64_t orig) {
17526         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
17527         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
17528         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
17529         return tag_ptr(ret_conv, true);
17530 }
17531
17532 void  __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
17533         LDKCVec_PublicKeyZ _res_constr;
17534         _res_constr.datalen = _res->arr_len;
17535         if (_res_constr.datalen > 0)
17536                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
17537         else
17538                 _res_constr.data = NULL;
17539         int8_tArray* _res_vals = (void*) _res->elems;
17540         for (size_t m = 0; m < _res_constr.datalen; m++) {
17541                 int8_tArray _res_conv_12 = _res_vals[m];
17542                 LDKPublicKey _res_conv_12_ref;
17543                 CHECK(_res_conv_12->arr_len == 33);
17544                 memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12);
17545                 _res_constr.data[m] = _res_conv_12_ref;
17546         }
17547         FREE(_res);
17548         CVec_PublicKeyZ_free(_res_constr);
17549 }
17550
17551 void  __attribute__((export_name("TS_CVec_TransactionZ_free"))) TS_CVec_TransactionZ_free(ptrArray _res) {
17552         LDKCVec_TransactionZ _res_constr;
17553         _res_constr.datalen = _res->arr_len;
17554         if (_res_constr.datalen > 0)
17555                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
17556         else
17557                 _res_constr.data = NULL;
17558         int8_tArray* _res_vals = (void*) _res->elems;
17559         for (size_t m = 0; m < _res_constr.datalen; m++) {
17560                 int8_tArray _res_conv_12 = _res_vals[m];
17561                 LDKTransaction _res_conv_12_ref;
17562                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
17563                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes");
17564                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
17565                 _res_conv_12_ref.data_is_owned = true;
17566                 _res_constr.data[m] = _res_conv_12_ref;
17567         }
17568         FREE(_res);
17569         CVec_TransactionZ_free(_res_constr);
17570 }
17571
17572 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
17573         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17574         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
17575         return tag_ptr(ret_conv, true);
17576 }
17577 int64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone_ptr"))) TS_C2Tuple_usizeTransactionZ_clone_ptr(uint64_t arg) {
17578         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
17579         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
17580         return ret_conv;
17581 }
17582
17583 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_clone"))) TS_C2Tuple_usizeTransactionZ_clone(uint64_t orig) {
17584         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
17585         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17586         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
17587         return tag_ptr(ret_conv, true);
17588 }
17589
17590 uint64_t  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_new"))) TS_C2Tuple_usizeTransactionZ_new(uint32_t a, int8_tArray b) {
17591         LDKTransaction b_ref;
17592         b_ref.datalen = b->arr_len;
17593         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
17594         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
17595         b_ref.data_is_owned = true;
17596         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
17597         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
17598         return tag_ptr(ret_conv, true);
17599 }
17600
17601 void  __attribute__((export_name("TS_C2Tuple_usizeTransactionZ_free"))) TS_C2Tuple_usizeTransactionZ_free(uint64_t _res) {
17602         if (!ptr_is_owned(_res)) return;
17603         void* _res_ptr = untag_ptr(_res);
17604         CHECK_ACCESS(_res_ptr);
17605         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
17606         FREE(untag_ptr(_res));
17607         C2Tuple_usizeTransactionZ_free(_res_conv);
17608 }
17609
17610 void  __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS_CVec_C2Tuple_usizeTransactionZZ_free(uint64_tArray _res) {
17611         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
17612         _res_constr.datalen = _res->arr_len;
17613         if (_res_constr.datalen > 0)
17614                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
17615         else
17616                 _res_constr.data = NULL;
17617         uint64_t* _res_vals = _res->elems;
17618         for (size_t c = 0; c < _res_constr.datalen; c++) {
17619                 uint64_t _res_conv_28 = _res_vals[c];
17620                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
17621                 CHECK_ACCESS(_res_conv_28_ptr);
17622                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
17623                 FREE(untag_ptr(_res_conv_28));
17624                 _res_constr.data[c] = _res_conv_28_conv;
17625         }
17626         FREE(_res);
17627         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
17628 }
17629
17630 uint64_t  __attribute__((export_name("TS_COption_BlockHashZ_some"))) TS_COption_BlockHashZ_some(int8_tArray o) {
17631         LDKThirtyTwoBytes o_ref;
17632         CHECK(o->arr_len == 32);
17633         memcpy(o_ref.data, o->elems, 32); FREE(o);
17634         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
17635         *ret_copy = COption_BlockHashZ_some(o_ref);
17636         uint64_t ret_ref = tag_ptr(ret_copy, true);
17637         return ret_ref;
17638 }
17639
17640 uint64_t  __attribute__((export_name("TS_COption_BlockHashZ_none"))) TS_COption_BlockHashZ_none() {
17641         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
17642         *ret_copy = COption_BlockHashZ_none();
17643         uint64_t ret_ref = tag_ptr(ret_copy, true);
17644         return ret_ref;
17645 }
17646
17647 void  __attribute__((export_name("TS_COption_BlockHashZ_free"))) TS_COption_BlockHashZ_free(uint64_t _res) {
17648         if (!ptr_is_owned(_res)) return;
17649         void* _res_ptr = untag_ptr(_res);
17650         CHECK_ACCESS(_res_ptr);
17651         LDKCOption_BlockHashZ _res_conv = *(LDKCOption_BlockHashZ*)(_res_ptr);
17652         FREE(untag_ptr(_res));
17653         COption_BlockHashZ_free(_res_conv);
17654 }
17655
17656 static inline uint64_t COption_BlockHashZ_clone_ptr(LDKCOption_BlockHashZ *NONNULL_PTR arg) {
17657         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
17658         *ret_copy = COption_BlockHashZ_clone(arg);
17659         uint64_t ret_ref = tag_ptr(ret_copy, true);
17660         return ret_ref;
17661 }
17662 int64_t  __attribute__((export_name("TS_COption_BlockHashZ_clone_ptr"))) TS_COption_BlockHashZ_clone_ptr(uint64_t arg) {
17663         LDKCOption_BlockHashZ* arg_conv = (LDKCOption_BlockHashZ*)untag_ptr(arg);
17664         int64_t ret_conv = COption_BlockHashZ_clone_ptr(arg_conv);
17665         return ret_conv;
17666 }
17667
17668 uint64_t  __attribute__((export_name("TS_COption_BlockHashZ_clone"))) TS_COption_BlockHashZ_clone(uint64_t orig) {
17669         LDKCOption_BlockHashZ* orig_conv = (LDKCOption_BlockHashZ*)untag_ptr(orig);
17670         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
17671         *ret_copy = COption_BlockHashZ_clone(orig_conv);
17672         uint64_t ret_ref = tag_ptr(ret_copy, true);
17673         return ret_ref;
17674 }
17675
17676 static inline uint64_t C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(LDKC2Tuple_TxidCOption_BlockHashZZ *NONNULL_PTR arg) {
17677         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
17678         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone(arg);
17679         return tag_ptr(ret_conv, true);
17680 }
17681 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_clone_ptr"))) TS_C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(uint64_t arg) {
17682         LDKC2Tuple_TxidCOption_BlockHashZZ* arg_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(arg);
17683         int64_t ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone_ptr(arg_conv);
17684         return ret_conv;
17685 }
17686
17687 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_clone"))) TS_C2Tuple_TxidCOption_BlockHashZZ_clone(uint64_t orig) {
17688         LDKC2Tuple_TxidCOption_BlockHashZZ* orig_conv = (LDKC2Tuple_TxidCOption_BlockHashZZ*)untag_ptr(orig);
17689         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
17690         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_clone(orig_conv);
17691         return tag_ptr(ret_conv, true);
17692 }
17693
17694 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_new"))) TS_C2Tuple_TxidCOption_BlockHashZZ_new(int8_tArray a, uint64_t b) {
17695         LDKThirtyTwoBytes a_ref;
17696         CHECK(a->arr_len == 32);
17697         memcpy(a_ref.data, a->elems, 32); FREE(a);
17698         void* b_ptr = untag_ptr(b);
17699         CHECK_ACCESS(b_ptr);
17700         LDKCOption_BlockHashZ b_conv = *(LDKCOption_BlockHashZ*)(b_ptr);
17701         b_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(b));
17702         LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
17703         *ret_conv = C2Tuple_TxidCOption_BlockHashZZ_new(a_ref, b_conv);
17704         return tag_ptr(ret_conv, true);
17705 }
17706
17707 void  __attribute__((export_name("TS_C2Tuple_TxidCOption_BlockHashZZ_free"))) TS_C2Tuple_TxidCOption_BlockHashZZ_free(uint64_t _res) {
17708         if (!ptr_is_owned(_res)) return;
17709         void* _res_ptr = untag_ptr(_res);
17710         CHECK_ACCESS(_res_ptr);
17711         LDKC2Tuple_TxidCOption_BlockHashZZ _res_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(_res_ptr);
17712         FREE(untag_ptr(_res));
17713         C2Tuple_TxidCOption_BlockHashZZ_free(_res_conv);
17714 }
17715
17716 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCOption_BlockHashZZZ_free"))) TS_CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(uint64_tArray _res) {
17717         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ _res_constr;
17718         _res_constr.datalen = _res->arr_len;
17719         if (_res_constr.datalen > 0)
17720                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ Elements");
17721         else
17722                 _res_constr.data = NULL;
17723         uint64_t* _res_vals = _res->elems;
17724         for (size_t i = 0; i < _res_constr.datalen; i++) {
17725                 uint64_t _res_conv_34 = _res_vals[i];
17726                 void* _res_conv_34_ptr = untag_ptr(_res_conv_34);
17727                 CHECK_ACCESS(_res_conv_34_ptr);
17728                 LDKC2Tuple_TxidCOption_BlockHashZZ _res_conv_34_conv = *(LDKC2Tuple_TxidCOption_BlockHashZZ*)(_res_conv_34_ptr);
17729                 FREE(untag_ptr(_res_conv_34));
17730                 _res_constr.data[i] = _res_conv_34_conv;
17731         }
17732         FREE(_res);
17733         CVec_C2Tuple_TxidCOption_BlockHashZZZ_free(_res_constr);
17734 }
17735
17736 void  __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) {
17737         LDKCVec_MonitorEventZ _res_constr;
17738         _res_constr.datalen = _res->arr_len;
17739         if (_res_constr.datalen > 0)
17740                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17741         else
17742                 _res_constr.data = NULL;
17743         uint64_t* _res_vals = _res->elems;
17744         for (size_t o = 0; o < _res_constr.datalen; o++) {
17745                 uint64_t _res_conv_14 = _res_vals[o];
17746                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
17747                 CHECK_ACCESS(_res_conv_14_ptr);
17748                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
17749                 FREE(untag_ptr(_res_conv_14));
17750                 _res_constr.data[o] = _res_conv_14_conv;
17751         }
17752         FREE(_res);
17753         CVec_MonitorEventZ_free(_res_constr);
17754 }
17755
17756 static inline uint64_t C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
17757         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17758         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(arg);
17759         return tag_ptr(ret_conv, true);
17760 }
17761 int64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(uint64_t arg) {
17762         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
17763         int64_t ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
17764         return ret_conv;
17765 }
17766
17767 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(uint64_t orig) {
17768         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
17769         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17770         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
17771         return tag_ptr(ret_conv, true);
17772 }
17773
17774 uint64_t  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(uint64_t a, uint64_tArray b, int8_tArray c) {
17775         LDKOutPoint a_conv;
17776         a_conv.inner = untag_ptr(a);
17777         a_conv.is_owned = ptr_is_owned(a);
17778         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
17779         a_conv = OutPoint_clone(&a_conv);
17780         LDKCVec_MonitorEventZ b_constr;
17781         b_constr.datalen = b->arr_len;
17782         if (b_constr.datalen > 0)
17783                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
17784         else
17785                 b_constr.data = NULL;
17786         uint64_t* b_vals = b->elems;
17787         for (size_t o = 0; o < b_constr.datalen; o++) {
17788                 uint64_t b_conv_14 = b_vals[o];
17789                 void* b_conv_14_ptr = untag_ptr(b_conv_14);
17790                 CHECK_ACCESS(b_conv_14_ptr);
17791                 LDKMonitorEvent b_conv_14_conv = *(LDKMonitorEvent*)(b_conv_14_ptr);
17792                 b_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(b_conv_14));
17793                 b_constr.data[o] = b_conv_14_conv;
17794         }
17795         FREE(b);
17796         LDKPublicKey c_ref;
17797         CHECK(c->arr_len == 33);
17798         memcpy(c_ref.compressed_form, c->elems, 33); FREE(c);
17799         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ");
17800         *ret_conv = C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(a_conv, b_constr, c_ref);
17801         return tag_ptr(ret_conv, true);
17802 }
17803
17804 void  __attribute__((export_name("TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free"))) TS_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(uint64_t _res) {
17805         if (!ptr_is_owned(_res)) return;
17806         void* _res_ptr = untag_ptr(_res);
17807         CHECK_ACCESS(_res_ptr);
17808         LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
17809         FREE(untag_ptr(_res));
17810         C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(_res_conv);
17811 }
17812
17813 void  __attribute__((export_name("TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free"))) TS_CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(uint64_tArray _res) {
17814         LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res_constr;
17815         _res_constr.datalen = _res->arr_len;
17816         if (_res_constr.datalen > 0)
17817                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ), "LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ Elements");
17818         else
17819                 _res_constr.data = NULL;
17820         uint64_t* _res_vals = _res->elems;
17821         for (size_t x = 0; x < _res_constr.datalen; x++) {
17822                 uint64_t _res_conv_49 = _res_vals[x];
17823                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
17824                 CHECK_ACCESS(_res_conv_49_ptr);
17825                 LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res_conv_49_conv = *(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ*)(_res_conv_49_ptr);
17826                 FREE(untag_ptr(_res_conv_49));
17827                 _res_constr.data[x] = _res_conv_49_conv;
17828         }
17829         FREE(_res);
17830         CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
17831 }
17832
17833 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_ok(uint64_t o) {
17834         LDKFixedPenaltyScorer o_conv;
17835         o_conv.inner = untag_ptr(o);
17836         o_conv.is_owned = ptr_is_owned(o);
17837         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
17838         o_conv = FixedPenaltyScorer_clone(&o_conv);
17839         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17840         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
17841         return tag_ptr(ret_conv, true);
17842 }
17843
17844 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_err"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_err(uint64_t e) {
17845         void* e_ptr = untag_ptr(e);
17846         CHECK_ACCESS(e_ptr);
17847         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
17848         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
17849         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17850         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
17851         return tag_ptr(ret_conv, true);
17852 }
17853
17854 jboolean  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(uint64_t o) {
17855         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
17856         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
17857         return ret_conv;
17858 }
17859
17860 void  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_free"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_free(uint64_t _res) {
17861         if (!ptr_is_owned(_res)) return;
17862         void* _res_ptr = untag_ptr(_res);
17863         CHECK_ACCESS(_res_ptr);
17864         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
17865         FREE(untag_ptr(_res));
17866         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
17867 }
17868
17869 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
17870         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17871         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
17872         return tag_ptr(ret_conv, true);
17873 }
17874 int64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(uint64_t arg) {
17875         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
17876         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
17877         return ret_conv;
17878 }
17879
17880 uint64_t  __attribute__((export_name("TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone"))) TS_CResult_FixedPenaltyScorerDecodeErrorZ_clone(uint64_t orig) {
17881         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
17882         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
17883         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
17884         return tag_ptr(ret_conv, true);
17885 }
17886
17887 void  __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) {
17888         LDKCVec_NodeIdZ _res_constr;
17889         _res_constr.datalen = _res->arr_len;
17890         if (_res_constr.datalen > 0)
17891                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
17892         else
17893                 _res_constr.data = NULL;
17894         uint64_t* _res_vals = _res->elems;
17895         for (size_t i = 0; i < _res_constr.datalen; i++) {
17896                 uint64_t _res_conv_8 = _res_vals[i];
17897                 LDKNodeId _res_conv_8_conv;
17898                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
17899                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
17900                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
17901                 _res_constr.data[i] = _res_conv_8_conv;
17902         }
17903         FREE(_res);
17904         CVec_NodeIdZ_free(_res_constr);
17905 }
17906
17907 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
17908         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17909         *ret_conv = C2Tuple_u64u64Z_clone(arg);
17910         return tag_ptr(ret_conv, true);
17911 }
17912 int64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone_ptr"))) TS_C2Tuple_u64u64Z_clone_ptr(uint64_t arg) {
17913         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
17914         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
17915         return ret_conv;
17916 }
17917
17918 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_clone"))) TS_C2Tuple_u64u64Z_clone(uint64_t orig) {
17919         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
17920         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17921         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
17922         return tag_ptr(ret_conv, true);
17923 }
17924
17925 uint64_t  __attribute__((export_name("TS_C2Tuple_u64u64Z_new"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) {
17926         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
17927         *ret_conv = C2Tuple_u64u64Z_new(a, b);
17928         return tag_ptr(ret_conv, true);
17929 }
17930
17931 void  __attribute__((export_name("TS_C2Tuple_u64u64Z_free"))) TS_C2Tuple_u64u64Z_free(uint64_t _res) {
17932         if (!ptr_is_owned(_res)) return;
17933         void* _res_ptr = untag_ptr(_res);
17934         CHECK_ACCESS(_res_ptr);
17935         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
17936         FREE(untag_ptr(_res));
17937         C2Tuple_u64u64Z_free(_res_conv);
17938 }
17939
17940 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_some"))) TS_COption_C2Tuple_u64u64ZZ_some(uint64_t o) {
17941         void* o_ptr = untag_ptr(o);
17942         CHECK_ACCESS(o_ptr);
17943         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
17944         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
17945         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17946         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
17947         uint64_t ret_ref = tag_ptr(ret_copy, true);
17948         return ret_ref;
17949 }
17950
17951 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_none"))) TS_COption_C2Tuple_u64u64ZZ_none() {
17952         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17953         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
17954         uint64_t ret_ref = tag_ptr(ret_copy, true);
17955         return ret_ref;
17956 }
17957
17958 void  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_free"))) TS_COption_C2Tuple_u64u64ZZ_free(uint64_t _res) {
17959         if (!ptr_is_owned(_res)) return;
17960         void* _res_ptr = untag_ptr(_res);
17961         CHECK_ACCESS(_res_ptr);
17962         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
17963         FREE(untag_ptr(_res));
17964         COption_C2Tuple_u64u64ZZ_free(_res_conv);
17965 }
17966
17967 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
17968         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17969         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
17970         uint64_t ret_ref = tag_ptr(ret_copy, true);
17971         return ret_ref;
17972 }
17973 int64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone_ptr"))) TS_COption_C2Tuple_u64u64ZZ_clone_ptr(uint64_t arg) {
17974         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
17975         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
17976         return ret_conv;
17977 }
17978
17979 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_COption_C2Tuple_u64u64ZZ_clone(uint64_t orig) {
17980         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
17981         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
17982         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
17983         uint64_t ret_ref = tag_ptr(ret_copy, true);
17984         return ret_ref;
17985 }
17986
17987 static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) {
17988         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
17989         *ret_conv = C2Tuple_Z_clone(arg);
17990         return tag_ptr(ret_conv, true);
17991 }
17992 int64_t  __attribute__((export_name("TS_C2Tuple_Z_clone_ptr"))) TS_C2Tuple_Z_clone_ptr(uint64_t arg) {
17993         LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg);
17994         int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv);
17995         return ret_conv;
17996 }
17997
17998 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_clone"))) TS_C2Tuple_Z_clone(uint64_t orig) {
17999         LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig);
18000         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
18001         *ret_conv = C2Tuple_Z_clone(orig_conv);
18002         return tag_ptr(ret_conv, true);
18003 }
18004
18005 uint64_t  __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) {
18006         LDKEightU16s a_ref;
18007         CHECK(a->arr_len == 8);
18008         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
18009         LDKEightU16s b_ref;
18010         CHECK(b->arr_len == 8);
18011         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
18012         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
18013         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
18014         return tag_ptr(ret_conv, true);
18015 }
18016
18017 void  __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) {
18018         if (!ptr_is_owned(_res)) return;
18019         void* _res_ptr = untag_ptr(_res);
18020         CHECK_ACCESS(_res_ptr);
18021         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
18022         FREE(untag_ptr(_res));
18023         C2Tuple_Z_free(_res_conv);
18024 }
18025
18026 static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) {
18027         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
18028         *ret_conv = C2Tuple__u168_u168Z_clone(arg);
18029         return tag_ptr(ret_conv, true);
18030 }
18031 int64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone_ptr"))) TS_C2Tuple__u168_u168Z_clone_ptr(uint64_t arg) {
18032         LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg);
18033         int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv);
18034         return ret_conv;
18035 }
18036
18037 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone"))) TS_C2Tuple__u168_u168Z_clone(uint64_t orig) {
18038         LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig);
18039         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
18040         *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv);
18041         return tag_ptr(ret_conv, true);
18042 }
18043
18044 uint64_t  __attribute__((export_name("TS_C2Tuple__u168_u168Z_new"))) TS_C2Tuple__u168_u168Z_new(int16_tArray a, int16_tArray b) {
18045         LDKEightU16s a_ref;
18046         CHECK(a->arr_len == 8);
18047         memcpy(a_ref.data, a->elems, 8 * 2); FREE(a);
18048         LDKEightU16s b_ref;
18049         CHECK(b->arr_len == 8);
18050         memcpy(b_ref.data, b->elems, 8 * 2); FREE(b);
18051         LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z");
18052         *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref);
18053         return tag_ptr(ret_conv, true);
18054 }
18055
18056 void  __attribute__((export_name("TS_C2Tuple__u168_u168Z_free"))) TS_C2Tuple__u168_u168Z_free(uint64_t _res) {
18057         if (!ptr_is_owned(_res)) return;
18058         void* _res_ptr = untag_ptr(_res);
18059         CHECK_ACCESS(_res_ptr);
18060         LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr);
18061         FREE(untag_ptr(_res));
18062         C2Tuple__u168_u168Z_free(_res_conv);
18063 }
18064
18065 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_some"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_some(uint64_t o) {
18066         void* o_ptr = untag_ptr(o);
18067         CHECK_ACCESS(o_ptr);
18068         LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr);
18069         o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o));
18070         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18071         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv);
18072         uint64_t ret_ref = tag_ptr(ret_copy, true);
18073         return ret_ref;
18074 }
18075
18076 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_none"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_none() {
18077         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18078         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none();
18079         uint64_t ret_ref = tag_ptr(ret_copy, true);
18080         return ret_ref;
18081 }
18082
18083 void  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_free"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_free(uint64_t _res) {
18084         if (!ptr_is_owned(_res)) return;
18085         void* _res_ptr = untag_ptr(_res);
18086         CHECK_ACCESS(_res_ptr);
18087         LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr);
18088         FREE(untag_ptr(_res));
18089         COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv);
18090 }
18091
18092 static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) {
18093         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18094         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg);
18095         uint64_t ret_ref = tag_ptr(ret_copy, true);
18096         return ret_ref;
18097 }
18098 int64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(uint64_t arg) {
18099         LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg);
18100         int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv);
18101         return ret_conv;
18102 }
18103
18104 uint64_t  __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone(uint64_t orig) {
18105         LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig);
18106         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
18107         *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv);
18108         uint64_t ret_ref = tag_ptr(ret_copy, true);
18109         return ret_ref;
18110 }
18111
18112 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_ok(uint64_t o) {
18113         LDKProbabilisticScorer o_conv;
18114         o_conv.inner = untag_ptr(o);
18115         o_conv.is_owned = ptr_is_owned(o);
18116         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18117         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
18118         
18119         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18120         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
18121         return tag_ptr(ret_conv, true);
18122 }
18123
18124 uint64_t  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_err"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_err(uint64_t e) {
18125         void* e_ptr = untag_ptr(e);
18126         CHECK_ACCESS(e_ptr);
18127         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18128         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18129         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
18130         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
18131         return tag_ptr(ret_conv, true);
18132 }
18133
18134 jboolean  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_is_ok(uint64_t o) {
18135         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
18136         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
18137         return ret_conv;
18138 }
18139
18140 void  __attribute__((export_name("TS_CResult_ProbabilisticScorerDecodeErrorZ_free"))) TS_CResult_ProbabilisticScorerDecodeErrorZ_free(uint64_t _res) {
18141         if (!ptr_is_owned(_res)) return;
18142         void* _res_ptr = untag_ptr(_res);
18143         CHECK_ACCESS(_res_ptr);
18144         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
18145         FREE(untag_ptr(_res));
18146         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
18147 }
18148
18149 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint64_t o) {
18150         LDKInitFeatures o_conv;
18151         o_conv.inner = untag_ptr(o);
18152         o_conv.is_owned = ptr_is_owned(o);
18153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18154         o_conv = InitFeatures_clone(&o_conv);
18155         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18156         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
18157         return tag_ptr(ret_conv, true);
18158 }
18159
18160 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_err"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint64_t e) {
18161         void* e_ptr = untag_ptr(e);
18162         CHECK_ACCESS(e_ptr);
18163         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18164         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18165         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18166         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
18167         return tag_ptr(ret_conv, true);
18168 }
18169
18170 jboolean  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18171         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
18172         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
18173         return ret_conv;
18174 }
18175
18176 void  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_free"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint64_t _res) {
18177         if (!ptr_is_owned(_res)) return;
18178         void* _res_ptr = untag_ptr(_res);
18179         CHECK_ACCESS(_res_ptr);
18180         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
18181         FREE(untag_ptr(_res));
18182         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
18183 }
18184
18185 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18186         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18187         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
18188         return tag_ptr(ret_conv, true);
18189 }
18190 int64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InitFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18191         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
18192         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18193         return ret_conv;
18194 }
18195
18196 uint64_t  __attribute__((export_name("TS_CResult_InitFeaturesDecodeErrorZ_clone"))) TS_CResult_InitFeaturesDecodeErrorZ_clone(uint64_t orig) {
18197         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
18198         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
18199         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
18200         return tag_ptr(ret_conv, true);
18201 }
18202
18203 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint64_t o) {
18204         LDKChannelFeatures o_conv;
18205         o_conv.inner = untag_ptr(o);
18206         o_conv.is_owned = ptr_is_owned(o);
18207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18208         o_conv = ChannelFeatures_clone(&o_conv);
18209         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18210         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
18211         return tag_ptr(ret_conv, true);
18212 }
18213
18214 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelFeaturesDecodeErrorZ_err(uint64_t e) {
18215         void* e_ptr = untag_ptr(e);
18216         CHECK_ACCESS(e_ptr);
18217         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18218         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18219         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18220         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
18221         return tag_ptr(ret_conv, true);
18222 }
18223
18224 jboolean  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18225         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
18226         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
18227         return ret_conv;
18228 }
18229
18230 void  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelFeaturesDecodeErrorZ_free(uint64_t _res) {
18231         if (!ptr_is_owned(_res)) return;
18232         void* _res_ptr = untag_ptr(_res);
18233         CHECK_ACCESS(_res_ptr);
18234         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
18235         FREE(untag_ptr(_res));
18236         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
18237 }
18238
18239 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18240         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18241         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
18242         return tag_ptr(ret_conv, true);
18243 }
18244 int64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18245         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
18246         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18247         return ret_conv;
18248 }
18249
18250 uint64_t  __attribute__((export_name("TS_CResult_ChannelFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelFeaturesDecodeErrorZ_clone(uint64_t orig) {
18251         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
18252         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
18253         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
18254         return tag_ptr(ret_conv, true);
18255 }
18256
18257 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint64_t o) {
18258         LDKNodeFeatures o_conv;
18259         o_conv.inner = untag_ptr(o);
18260         o_conv.is_owned = ptr_is_owned(o);
18261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18262         o_conv = NodeFeatures_clone(&o_conv);
18263         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18264         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
18265         return tag_ptr(ret_conv, true);
18266 }
18267
18268 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_err"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint64_t e) {
18269         void* e_ptr = untag_ptr(e);
18270         CHECK_ACCESS(e_ptr);
18271         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18272         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18273         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18274         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
18275         return tag_ptr(ret_conv, true);
18276 }
18277
18278 jboolean  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18279         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
18280         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
18281         return ret_conv;
18282 }
18283
18284 void  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_free"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint64_t _res) {
18285         if (!ptr_is_owned(_res)) return;
18286         void* _res_ptr = untag_ptr(_res);
18287         CHECK_ACCESS(_res_ptr);
18288         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
18289         FREE(untag_ptr(_res));
18290         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
18291 }
18292
18293 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18294         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18295         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
18296         return tag_ptr(ret_conv, true);
18297 }
18298 int64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18299         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
18300         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18301         return ret_conv;
18302 }
18303
18304 uint64_t  __attribute__((export_name("TS_CResult_NodeFeaturesDecodeErrorZ_clone"))) TS_CResult_NodeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18305         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
18306         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
18307         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
18308         return tag_ptr(ret_conv, true);
18309 }
18310
18311 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18312         LDKBolt11InvoiceFeatures o_conv;
18313         o_conv.inner = untag_ptr(o);
18314         o_conv.is_owned = ptr_is_owned(o);
18315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18316         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
18317         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18318         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18319         return tag_ptr(ret_conv, true);
18320 }
18321
18322 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18323         void* e_ptr = untag_ptr(e);
18324         CHECK_ACCESS(e_ptr);
18325         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18326         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18327         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18328         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
18329         return tag_ptr(ret_conv, true);
18330 }
18331
18332 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18333         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18334         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18335         return ret_conv;
18336 }
18337
18338 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18339         if (!ptr_is_owned(_res)) return;
18340         void* _res_ptr = untag_ptr(_res);
18341         CHECK_ACCESS(_res_ptr);
18342         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18343         FREE(untag_ptr(_res));
18344         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18345 }
18346
18347 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18348         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18349         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
18350         return tag_ptr(ret_conv, true);
18351 }
18352 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18353         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18354         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18355         return ret_conv;
18356 }
18357
18358 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18359         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18360         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
18361         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18362         return tag_ptr(ret_conv, true);
18363 }
18364
18365 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(uint64_t o) {
18366         LDKBolt12InvoiceFeatures o_conv;
18367         o_conv.inner = untag_ptr(o);
18368         o_conv.is_owned = ptr_is_owned(o);
18369         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18370         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
18371         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18372         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
18373         return tag_ptr(ret_conv, true);
18374 }
18375
18376 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(uint64_t e) {
18377         void* e_ptr = untag_ptr(e);
18378         CHECK_ACCESS(e_ptr);
18379         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18380         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18381         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18382         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
18383         return tag_ptr(ret_conv, true);
18384 }
18385
18386 jboolean  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18387         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
18388         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
18389         return ret_conv;
18390 }
18391
18392 void  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(uint64_t _res) {
18393         if (!ptr_is_owned(_res)) return;
18394         void* _res_ptr = untag_ptr(_res);
18395         CHECK_ACCESS(_res_ptr);
18396         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
18397         FREE(untag_ptr(_res));
18398         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
18399 }
18400
18401 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18402         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18403         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
18404         return tag_ptr(ret_conv, true);
18405 }
18406 int64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18407         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
18408         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18409         return ret_conv;
18410 }
18411
18412 uint64_t  __attribute__((export_name("TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone"))) TS_CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(uint64_t orig) {
18413         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
18414         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
18415         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
18416         return tag_ptr(ret_conv, true);
18417 }
18418
18419 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) {
18420         LDKBlindedHopFeatures o_conv;
18421         o_conv.inner = untag_ptr(o);
18422         o_conv.is_owned = ptr_is_owned(o);
18423         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18424         o_conv = BlindedHopFeatures_clone(&o_conv);
18425         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18426         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
18427         return tag_ptr(ret_conv, true);
18428 }
18429
18430 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_err(uint64_t e) {
18431         void* e_ptr = untag_ptr(e);
18432         CHECK_ACCESS(e_ptr);
18433         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18434         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18435         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18436         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
18437         return tag_ptr(ret_conv, true);
18438 }
18439
18440 jboolean  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18441         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
18442         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
18443         return ret_conv;
18444 }
18445
18446 void  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_free(uint64_t _res) {
18447         if (!ptr_is_owned(_res)) return;
18448         void* _res_ptr = untag_ptr(_res);
18449         CHECK_ACCESS(_res_ptr);
18450         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
18451         FREE(untag_ptr(_res));
18452         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
18453 }
18454
18455 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18456         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18457         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
18458         return tag_ptr(ret_conv, true);
18459 }
18460 int64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18461         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
18462         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18463         return ret_conv;
18464 }
18465
18466 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) {
18467         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
18468         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
18469         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
18470         return tag_ptr(ret_conv, true);
18471 }
18472
18473 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) {
18474         LDKChannelTypeFeatures o_conv;
18475         o_conv.inner = untag_ptr(o);
18476         o_conv.is_owned = ptr_is_owned(o);
18477         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
18478         o_conv = ChannelTypeFeatures_clone(&o_conv);
18479         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18480         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
18481         return tag_ptr(ret_conv, true);
18482 }
18483
18484 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint64_t e) {
18485         void* e_ptr = untag_ptr(e);
18486         CHECK_ACCESS(e_ptr);
18487         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18488         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18489         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18490         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
18491         return tag_ptr(ret_conv, true);
18492 }
18493
18494 jboolean  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) {
18495         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
18496         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
18497         return ret_conv;
18498 }
18499
18500 void  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) {
18501         if (!ptr_is_owned(_res)) return;
18502         void* _res_ptr = untag_ptr(_res);
18503         CHECK_ACCESS(_res_ptr);
18504         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
18505         FREE(untag_ptr(_res));
18506         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
18507 }
18508
18509 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
18510         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18511         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
18512         return tag_ptr(ret_conv, true);
18513 }
18514 int64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
18515         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
18516         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
18517         return ret_conv;
18518 }
18519
18520 uint64_t  __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) {
18521         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
18522         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
18523         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
18524         return tag_ptr(ret_conv, true);
18525 }
18526
18527 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) {
18528         void* o_ptr = untag_ptr(o);
18529         CHECK_ACCESS(o_ptr);
18530         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
18531         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
18532         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
18533         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
18534         return tag_ptr(ret_conv, true);
18535 }
18536
18537 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_err"))) TS_CResult_PaymentPurposeDecodeErrorZ_err(uint64_t e) {
18538         void* e_ptr = untag_ptr(e);
18539         CHECK_ACCESS(e_ptr);
18540         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18541         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18542         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
18543         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
18544         return tag_ptr(ret_conv, true);
18545 }
18546
18547 jboolean  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_is_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_is_ok(uint64_t o) {
18548         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
18549         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
18550         return ret_conv;
18551 }
18552
18553 void  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_free"))) TS_CResult_PaymentPurposeDecodeErrorZ_free(uint64_t _res) {
18554         if (!ptr_is_owned(_res)) return;
18555         void* _res_ptr = untag_ptr(_res);
18556         CHECK_ACCESS(_res_ptr);
18557         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
18558         FREE(untag_ptr(_res));
18559         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
18560 }
18561
18562 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
18563         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
18564         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
18565         return tag_ptr(ret_conv, true);
18566 }
18567 int64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone_ptr(uint64_t arg) {
18568         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
18569         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
18570         return ret_conv;
18571 }
18572
18573 uint64_t  __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clone"))) TS_CResult_PaymentPurposeDecodeErrorZ_clone(uint64_t orig) {
18574         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
18575         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
18576         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
18577         return tag_ptr(ret_conv, true);
18578 }
18579
18580 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) {
18581         void* o_ptr = untag_ptr(o);
18582         CHECK_ACCESS(o_ptr);
18583         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
18584         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
18585         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18586         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
18587         uint64_t ret_ref = tag_ptr(ret_copy, true);
18588         return ret_ref;
18589 }
18590
18591 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() {
18592         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18593         *ret_copy = COption_NetworkUpdateZ_none();
18594         uint64_t ret_ref = tag_ptr(ret_copy, true);
18595         return ret_ref;
18596 }
18597
18598 void  __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) {
18599         if (!ptr_is_owned(_res)) return;
18600         void* _res_ptr = untag_ptr(_res);
18601         CHECK_ACCESS(_res_ptr);
18602         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
18603         FREE(untag_ptr(_res));
18604         COption_NetworkUpdateZ_free(_res_conv);
18605 }
18606
18607 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
18608         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18609         *ret_copy = COption_NetworkUpdateZ_clone(arg);
18610         uint64_t ret_ref = tag_ptr(ret_copy, true);
18611         return ret_ref;
18612 }
18613 int64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) {
18614         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
18615         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
18616         return ret_conv;
18617 }
18618
18619 uint64_t  __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) {
18620         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
18621         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
18622         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
18623         uint64_t ret_ref = tag_ptr(ret_copy, true);
18624         return ret_ref;
18625 }
18626
18627 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) {
18628         void* o_ptr = untag_ptr(o);
18629         CHECK_ACCESS(o_ptr);
18630         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
18631         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
18632         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
18633         *ret_copy = COption_PathFailureZ_some(o_conv);
18634         uint64_t ret_ref = tag_ptr(ret_copy, true);
18635         return ret_ref;
18636 }
18637
18638 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() {
18639         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
18640         *ret_copy = COption_PathFailureZ_none();
18641         uint64_t ret_ref = tag_ptr(ret_copy, true);
18642         return ret_ref;
18643 }
18644
18645 void  __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) {
18646         if (!ptr_is_owned(_res)) return;
18647         void* _res_ptr = untag_ptr(_res);
18648         CHECK_ACCESS(_res_ptr);
18649         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
18650         FREE(untag_ptr(_res));
18651         COption_PathFailureZ_free(_res_conv);
18652 }
18653
18654 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
18655         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
18656         *ret_copy = COption_PathFailureZ_clone(arg);
18657         uint64_t ret_ref = tag_ptr(ret_copy, true);
18658         return ret_ref;
18659 }
18660 int64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) {
18661         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
18662         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
18663         return ret_conv;
18664 }
18665
18666 uint64_t  __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) {
18667         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
18668         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
18669         *ret_copy = COption_PathFailureZ_clone(orig_conv);
18670         uint64_t ret_ref = tag_ptr(ret_copy, true);
18671         return ret_ref;
18672 }
18673
18674 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) {
18675         void* o_ptr = untag_ptr(o);
18676         CHECK_ACCESS(o_ptr);
18677         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
18678         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
18679         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
18680         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
18681         return tag_ptr(ret_conv, true);
18682 }
18683
18684 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_err(uint64_t e) {
18685         void* e_ptr = untag_ptr(e);
18686         CHECK_ACCESS(e_ptr);
18687         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18688         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18689         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
18690         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
18691         return tag_ptr(ret_conv, true);
18692 }
18693
18694 jboolean  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) {
18695         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
18696         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
18697         return ret_conv;
18698 }
18699
18700 void  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) {
18701         if (!ptr_is_owned(_res)) return;
18702         void* _res_ptr = untag_ptr(_res);
18703         CHECK_ACCESS(_res_ptr);
18704         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
18705         FREE(untag_ptr(_res));
18706         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
18707 }
18708
18709 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
18710         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
18711         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
18712         return tag_ptr(ret_conv, true);
18713 }
18714 int64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) {
18715         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
18716         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
18717         return ret_conv;
18718 }
18719
18720 uint64_t  __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) {
18721         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
18722         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
18723         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
18724         return tag_ptr(ret_conv, true);
18725 }
18726
18727 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) {
18728         void* o_ptr = untag_ptr(o);
18729         CHECK_ACCESS(o_ptr);
18730         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
18731         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
18732         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
18733         *ret_copy = COption_ClosureReasonZ_some(o_conv);
18734         uint64_t ret_ref = tag_ptr(ret_copy, true);
18735         return ret_ref;
18736 }
18737
18738 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_none"))) TS_COption_ClosureReasonZ_none() {
18739         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
18740         *ret_copy = COption_ClosureReasonZ_none();
18741         uint64_t ret_ref = tag_ptr(ret_copy, true);
18742         return ret_ref;
18743 }
18744
18745 void  __attribute__((export_name("TS_COption_ClosureReasonZ_free"))) TS_COption_ClosureReasonZ_free(uint64_t _res) {
18746         if (!ptr_is_owned(_res)) return;
18747         void* _res_ptr = untag_ptr(_res);
18748         CHECK_ACCESS(_res_ptr);
18749         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
18750         FREE(untag_ptr(_res));
18751         COption_ClosureReasonZ_free(_res_conv);
18752 }
18753
18754 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
18755         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
18756         *ret_copy = COption_ClosureReasonZ_clone(arg);
18757         uint64_t ret_ref = tag_ptr(ret_copy, true);
18758         return ret_ref;
18759 }
18760 int64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone_ptr"))) TS_COption_ClosureReasonZ_clone_ptr(uint64_t arg) {
18761         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
18762         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
18763         return ret_conv;
18764 }
18765
18766 uint64_t  __attribute__((export_name("TS_COption_ClosureReasonZ_clone"))) TS_COption_ClosureReasonZ_clone(uint64_t orig) {
18767         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
18768         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
18769         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
18770         uint64_t ret_ref = tag_ptr(ret_copy, true);
18771         return ret_ref;
18772 }
18773
18774 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_ok(uint64_t o) {
18775         void* o_ptr = untag_ptr(o);
18776         CHECK_ACCESS(o_ptr);
18777         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
18778         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
18779         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
18780         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
18781         return tag_ptr(ret_conv, true);
18782 }
18783
18784 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_err"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_err(uint64_t e) {
18785         void* e_ptr = untag_ptr(e);
18786         CHECK_ACCESS(e_ptr);
18787         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18788         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18789         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
18790         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
18791         return tag_ptr(ret_conv, true);
18792 }
18793
18794 jboolean  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(uint64_t o) {
18795         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
18796         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
18797         return ret_conv;
18798 }
18799
18800 void  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_free"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_free(uint64_t _res) {
18801         if (!ptr_is_owned(_res)) return;
18802         void* _res_ptr = untag_ptr(_res);
18803         CHECK_ACCESS(_res_ptr);
18804         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
18805         FREE(untag_ptr(_res));
18806         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
18807 }
18808
18809 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
18810         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
18811         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
18812         return tag_ptr(ret_conv, true);
18813 }
18814 int64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(uint64_t arg) {
18815         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
18816         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
18817         return ret_conv;
18818 }
18819
18820 uint64_t  __attribute__((export_name("TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone"))) TS_CResult_COption_ClosureReasonZDecodeErrorZ_clone(uint64_t orig) {
18821         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
18822         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
18823         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
18824         return tag_ptr(ret_conv, true);
18825 }
18826
18827 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_some"))) TS_COption_HTLCDestinationZ_some(uint64_t o) {
18828         void* o_ptr = untag_ptr(o);
18829         CHECK_ACCESS(o_ptr);
18830         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
18831         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
18832         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
18833         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
18834         uint64_t ret_ref = tag_ptr(ret_copy, true);
18835         return ret_ref;
18836 }
18837
18838 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_none"))) TS_COption_HTLCDestinationZ_none() {
18839         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
18840         *ret_copy = COption_HTLCDestinationZ_none();
18841         uint64_t ret_ref = tag_ptr(ret_copy, true);
18842         return ret_ref;
18843 }
18844
18845 void  __attribute__((export_name("TS_COption_HTLCDestinationZ_free"))) TS_COption_HTLCDestinationZ_free(uint64_t _res) {
18846         if (!ptr_is_owned(_res)) return;
18847         void* _res_ptr = untag_ptr(_res);
18848         CHECK_ACCESS(_res_ptr);
18849         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
18850         FREE(untag_ptr(_res));
18851         COption_HTLCDestinationZ_free(_res_conv);
18852 }
18853
18854 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
18855         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
18856         *ret_copy = COption_HTLCDestinationZ_clone(arg);
18857         uint64_t ret_ref = tag_ptr(ret_copy, true);
18858         return ret_ref;
18859 }
18860 int64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone_ptr"))) TS_COption_HTLCDestinationZ_clone_ptr(uint64_t arg) {
18861         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
18862         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
18863         return ret_conv;
18864 }
18865
18866 uint64_t  __attribute__((export_name("TS_COption_HTLCDestinationZ_clone"))) TS_COption_HTLCDestinationZ_clone(uint64_t orig) {
18867         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
18868         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
18869         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
18870         uint64_t ret_ref = tag_ptr(ret_copy, true);
18871         return ret_ref;
18872 }
18873
18874 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_ok(uint64_t o) {
18875         void* o_ptr = untag_ptr(o);
18876         CHECK_ACCESS(o_ptr);
18877         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
18878         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
18879         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18880         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
18881         return tag_ptr(ret_conv, true);
18882 }
18883
18884 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_err(uint64_t e) {
18885         void* e_ptr = untag_ptr(e);
18886         CHECK_ACCESS(e_ptr);
18887         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18888         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18889         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18890         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
18891         return tag_ptr(ret_conv, true);
18892 }
18893
18894 jboolean  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(uint64_t o) {
18895         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
18896         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
18897         return ret_conv;
18898 }
18899
18900 void  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_free(uint64_t _res) {
18901         if (!ptr_is_owned(_res)) return;
18902         void* _res_ptr = untag_ptr(_res);
18903         CHECK_ACCESS(_res_ptr);
18904         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
18905         FREE(untag_ptr(_res));
18906         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
18907 }
18908
18909 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
18910         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18911         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
18912         return tag_ptr(ret_conv, true);
18913 }
18914 int64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(uint64_t arg) {
18915         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
18916         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
18917         return ret_conv;
18918 }
18919
18920 uint64_t  __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone"))) TS_CResult_COption_HTLCDestinationZDecodeErrorZ_clone(uint64_t orig) {
18921         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
18922         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
18923         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
18924         return tag_ptr(ret_conv, true);
18925 }
18926
18927 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_ok(uint32_t o) {
18928         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
18929         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
18930         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
18931         return tag_ptr(ret_conv, true);
18932 }
18933
18934 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_err"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_err(uint64_t e) {
18935         void* e_ptr = untag_ptr(e);
18936         CHECK_ACCESS(e_ptr);
18937         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
18938         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
18939         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
18940         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
18941         return tag_ptr(ret_conv, true);
18942 }
18943
18944 jboolean  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_is_ok(uint64_t o) {
18945         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
18946         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
18947         return ret_conv;
18948 }
18949
18950 void  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_free"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_free(uint64_t _res) {
18951         if (!ptr_is_owned(_res)) return;
18952         void* _res_ptr = untag_ptr(_res);
18953         CHECK_ACCESS(_res_ptr);
18954         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
18955         FREE(untag_ptr(_res));
18956         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
18957 }
18958
18959 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
18960         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
18961         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
18962         return tag_ptr(ret_conv, true);
18963 }
18964 int64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(uint64_t arg) {
18965         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
18966         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
18967         return ret_conv;
18968 }
18969
18970 uint64_t  __attribute__((export_name("TS_CResult_PaymentFailureReasonDecodeErrorZ_clone"))) TS_CResult_PaymentFailureReasonDecodeErrorZ_clone(uint64_t orig) {
18971         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
18972         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
18973         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
18974         return tag_ptr(ret_conv, true);
18975 }
18976
18977 uint64_t  __attribute__((export_name("TS_COption_u128Z_some"))) TS_COption_u128Z_some(int8_tArray o) {
18978         LDKU128 o_ref;
18979         CHECK(o->arr_len == 16);
18980         memcpy(o_ref.le_bytes, o->elems, 16); FREE(o);
18981         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
18982         *ret_copy = COption_u128Z_some(o_ref);
18983         uint64_t ret_ref = tag_ptr(ret_copy, true);
18984         return ret_ref;
18985 }
18986
18987 uint64_t  __attribute__((export_name("TS_COption_u128Z_none"))) TS_COption_u128Z_none() {
18988         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
18989         *ret_copy = COption_u128Z_none();
18990         uint64_t ret_ref = tag_ptr(ret_copy, true);
18991         return ret_ref;
18992 }
18993
18994 void  __attribute__((export_name("TS_COption_u128Z_free"))) TS_COption_u128Z_free(uint64_t _res) {
18995         if (!ptr_is_owned(_res)) return;
18996         void* _res_ptr = untag_ptr(_res);
18997         CHECK_ACCESS(_res_ptr);
18998         LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr);
18999         FREE(untag_ptr(_res));
19000         COption_u128Z_free(_res_conv);
19001 }
19002
19003 static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) {
19004         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
19005         *ret_copy = COption_u128Z_clone(arg);
19006         uint64_t ret_ref = tag_ptr(ret_copy, true);
19007         return ret_ref;
19008 }
19009 int64_t  __attribute__((export_name("TS_COption_u128Z_clone_ptr"))) TS_COption_u128Z_clone_ptr(uint64_t arg) {
19010         LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg);
19011         int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv);
19012         return ret_conv;
19013 }
19014
19015 uint64_t  __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128Z_clone(uint64_t orig) {
19016         LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig);
19017         LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z");
19018         *ret_copy = COption_u128Z_clone(orig_conv);
19019         uint64_t ret_ref = tag_ptr(ret_copy, true);
19020         return ret_ref;
19021 }
19022
19023 uint64_t  __attribute__((export_name("TS_COption_PaymentIdZ_some"))) TS_COption_PaymentIdZ_some(int8_tArray o) {
19024         LDKThirtyTwoBytes o_ref;
19025         CHECK(o->arr_len == 32);
19026         memcpy(o_ref.data, o->elems, 32); FREE(o);
19027         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
19028         *ret_copy = COption_PaymentIdZ_some(o_ref);
19029         uint64_t ret_ref = tag_ptr(ret_copy, true);
19030         return ret_ref;
19031 }
19032
19033 uint64_t  __attribute__((export_name("TS_COption_PaymentIdZ_none"))) TS_COption_PaymentIdZ_none() {
19034         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
19035         *ret_copy = COption_PaymentIdZ_none();
19036         uint64_t ret_ref = tag_ptr(ret_copy, true);
19037         return ret_ref;
19038 }
19039
19040 void  __attribute__((export_name("TS_COption_PaymentIdZ_free"))) TS_COption_PaymentIdZ_free(uint64_t _res) {
19041         if (!ptr_is_owned(_res)) return;
19042         void* _res_ptr = untag_ptr(_res);
19043         CHECK_ACCESS(_res_ptr);
19044         LDKCOption_PaymentIdZ _res_conv = *(LDKCOption_PaymentIdZ*)(_res_ptr);
19045         FREE(untag_ptr(_res));
19046         COption_PaymentIdZ_free(_res_conv);
19047 }
19048
19049 static inline uint64_t COption_PaymentIdZ_clone_ptr(LDKCOption_PaymentIdZ *NONNULL_PTR arg) {
19050         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
19051         *ret_copy = COption_PaymentIdZ_clone(arg);
19052         uint64_t ret_ref = tag_ptr(ret_copy, true);
19053         return ret_ref;
19054 }
19055 int64_t  __attribute__((export_name("TS_COption_PaymentIdZ_clone_ptr"))) TS_COption_PaymentIdZ_clone_ptr(uint64_t arg) {
19056         LDKCOption_PaymentIdZ* arg_conv = (LDKCOption_PaymentIdZ*)untag_ptr(arg);
19057         int64_t ret_conv = COption_PaymentIdZ_clone_ptr(arg_conv);
19058         return ret_conv;
19059 }
19060
19061 uint64_t  __attribute__((export_name("TS_COption_PaymentIdZ_clone"))) TS_COption_PaymentIdZ_clone(uint64_t orig) {
19062         LDKCOption_PaymentIdZ* orig_conv = (LDKCOption_PaymentIdZ*)untag_ptr(orig);
19063         LDKCOption_PaymentIdZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentIdZ), "LDKCOption_PaymentIdZ");
19064         *ret_copy = COption_PaymentIdZ_clone(orig_conv);
19065         uint64_t ret_ref = tag_ptr(ret_copy, true);
19066         return ret_ref;
19067 }
19068
19069 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_some"))) TS_COption_PaymentFailureReasonZ_some(uint32_t o) {
19070         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_js(o);
19071         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
19072         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
19073         uint64_t ret_ref = tag_ptr(ret_copy, true);
19074         return ret_ref;
19075 }
19076
19077 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_none"))) TS_COption_PaymentFailureReasonZ_none() {
19078         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
19079         *ret_copy = COption_PaymentFailureReasonZ_none();
19080         uint64_t ret_ref = tag_ptr(ret_copy, true);
19081         return ret_ref;
19082 }
19083
19084 void  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_free"))) TS_COption_PaymentFailureReasonZ_free(uint64_t _res) {
19085         if (!ptr_is_owned(_res)) return;
19086         void* _res_ptr = untag_ptr(_res);
19087         CHECK_ACCESS(_res_ptr);
19088         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
19089         FREE(untag_ptr(_res));
19090         COption_PaymentFailureReasonZ_free(_res_conv);
19091 }
19092
19093 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
19094         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
19095         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
19096         uint64_t ret_ref = tag_ptr(ret_copy, true);
19097         return ret_ref;
19098 }
19099 int64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone_ptr"))) TS_COption_PaymentFailureReasonZ_clone_ptr(uint64_t arg) {
19100         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
19101         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
19102         return ret_conv;
19103 }
19104
19105 uint64_t  __attribute__((export_name("TS_COption_PaymentFailureReasonZ_clone"))) TS_COption_PaymentFailureReasonZ_clone(uint64_t orig) {
19106         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
19107         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
19108         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
19109         uint64_t ret_ref = tag_ptr(ret_copy, true);
19110         return ret_ref;
19111 }
19112
19113 uint64_t  __attribute__((export_name("TS_COption_PaymentHashZ_some"))) TS_COption_PaymentHashZ_some(int8_tArray o) {
19114         LDKThirtyTwoBytes o_ref;
19115         CHECK(o->arr_len == 32);
19116         memcpy(o_ref.data, o->elems, 32); FREE(o);
19117         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
19118         *ret_copy = COption_PaymentHashZ_some(o_ref);
19119         uint64_t ret_ref = tag_ptr(ret_copy, true);
19120         return ret_ref;
19121 }
19122
19123 uint64_t  __attribute__((export_name("TS_COption_PaymentHashZ_none"))) TS_COption_PaymentHashZ_none() {
19124         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
19125         *ret_copy = COption_PaymentHashZ_none();
19126         uint64_t ret_ref = tag_ptr(ret_copy, true);
19127         return ret_ref;
19128 }
19129
19130 void  __attribute__((export_name("TS_COption_PaymentHashZ_free"))) TS_COption_PaymentHashZ_free(uint64_t _res) {
19131         if (!ptr_is_owned(_res)) return;
19132         void* _res_ptr = untag_ptr(_res);
19133         CHECK_ACCESS(_res_ptr);
19134         LDKCOption_PaymentHashZ _res_conv = *(LDKCOption_PaymentHashZ*)(_res_ptr);
19135         FREE(untag_ptr(_res));
19136         COption_PaymentHashZ_free(_res_conv);
19137 }
19138
19139 static inline uint64_t COption_PaymentHashZ_clone_ptr(LDKCOption_PaymentHashZ *NONNULL_PTR arg) {
19140         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
19141         *ret_copy = COption_PaymentHashZ_clone(arg);
19142         uint64_t ret_ref = tag_ptr(ret_copy, true);
19143         return ret_ref;
19144 }
19145 int64_t  __attribute__((export_name("TS_COption_PaymentHashZ_clone_ptr"))) TS_COption_PaymentHashZ_clone_ptr(uint64_t arg) {
19146         LDKCOption_PaymentHashZ* arg_conv = (LDKCOption_PaymentHashZ*)untag_ptr(arg);
19147         int64_t ret_conv = COption_PaymentHashZ_clone_ptr(arg_conv);
19148         return ret_conv;
19149 }
19150
19151 uint64_t  __attribute__((export_name("TS_COption_PaymentHashZ_clone"))) TS_COption_PaymentHashZ_clone(uint64_t orig) {
19152         LDKCOption_PaymentHashZ* orig_conv = (LDKCOption_PaymentHashZ*)untag_ptr(orig);
19153         LDKCOption_PaymentHashZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentHashZ), "LDKCOption_PaymentHashZ");
19154         *ret_copy = COption_PaymentHashZ_clone(orig_conv);
19155         uint64_t ret_ref = tag_ptr(ret_copy, true);
19156         return ret_ref;
19157 }
19158
19159 uint64_t  __attribute__((export_name("TS_COption_EventZ_some"))) TS_COption_EventZ_some(uint64_t o) {
19160         void* o_ptr = untag_ptr(o);
19161         CHECK_ACCESS(o_ptr);
19162         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
19163         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
19164         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
19165         *ret_copy = COption_EventZ_some(o_conv);
19166         uint64_t ret_ref = tag_ptr(ret_copy, true);
19167         return ret_ref;
19168 }
19169
19170 uint64_t  __attribute__((export_name("TS_COption_EventZ_none"))) TS_COption_EventZ_none() {
19171         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
19172         *ret_copy = COption_EventZ_none();
19173         uint64_t ret_ref = tag_ptr(ret_copy, true);
19174         return ret_ref;
19175 }
19176
19177 void  __attribute__((export_name("TS_COption_EventZ_free"))) TS_COption_EventZ_free(uint64_t _res) {
19178         if (!ptr_is_owned(_res)) return;
19179         void* _res_ptr = untag_ptr(_res);
19180         CHECK_ACCESS(_res_ptr);
19181         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
19182         FREE(untag_ptr(_res));
19183         COption_EventZ_free(_res_conv);
19184 }
19185
19186 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
19187         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
19188         *ret_copy = COption_EventZ_clone(arg);
19189         uint64_t ret_ref = tag_ptr(ret_copy, true);
19190         return ret_ref;
19191 }
19192 int64_t  __attribute__((export_name("TS_COption_EventZ_clone_ptr"))) TS_COption_EventZ_clone_ptr(uint64_t arg) {
19193         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
19194         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
19195         return ret_conv;
19196 }
19197
19198 uint64_t  __attribute__((export_name("TS_COption_EventZ_clone"))) TS_COption_EventZ_clone(uint64_t orig) {
19199         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
19200         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
19201         *ret_copy = COption_EventZ_clone(orig_conv);
19202         uint64_t ret_ref = tag_ptr(ret_copy, true);
19203         return ret_ref;
19204 }
19205
19206 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_ok"))) TS_CResult_COption_EventZDecodeErrorZ_ok(uint64_t o) {
19207         void* o_ptr = untag_ptr(o);
19208         CHECK_ACCESS(o_ptr);
19209         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
19210         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
19211         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19212         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
19213         return tag_ptr(ret_conv, true);
19214 }
19215
19216 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_err"))) TS_CResult_COption_EventZDecodeErrorZ_err(uint64_t e) {
19217         void* e_ptr = untag_ptr(e);
19218         CHECK_ACCESS(e_ptr);
19219         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19220         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19221         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19222         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
19223         return tag_ptr(ret_conv, true);
19224 }
19225
19226 jboolean  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_is_ok"))) TS_CResult_COption_EventZDecodeErrorZ_is_ok(uint64_t o) {
19227         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
19228         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
19229         return ret_conv;
19230 }
19231
19232 void  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_free"))) TS_CResult_COption_EventZDecodeErrorZ_free(uint64_t _res) {
19233         if (!ptr_is_owned(_res)) return;
19234         void* _res_ptr = untag_ptr(_res);
19235         CHECK_ACCESS(_res_ptr);
19236         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
19237         FREE(untag_ptr(_res));
19238         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
19239 }
19240
19241 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
19242         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19243         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
19244         return tag_ptr(ret_conv, true);
19245 }
19246 int64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_EventZDecodeErrorZ_clone_ptr(uint64_t arg) {
19247         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
19248         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
19249         return ret_conv;
19250 }
19251
19252 uint64_t  __attribute__((export_name("TS_CResult_COption_EventZDecodeErrorZ_clone"))) TS_CResult_COption_EventZDecodeErrorZ_clone(uint64_t orig) {
19253         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
19254         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
19255         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
19256         return tag_ptr(ret_conv, true);
19257 }
19258
19259 void  __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_MessageSendEventZ_free(uint64_tArray _res) {
19260         LDKCVec_MessageSendEventZ _res_constr;
19261         _res_constr.datalen = _res->arr_len;
19262         if (_res_constr.datalen > 0)
19263                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
19264         else
19265                 _res_constr.data = NULL;
19266         uint64_t* _res_vals = _res->elems;
19267         for (size_t s = 0; s < _res_constr.datalen; s++) {
19268                 uint64_t _res_conv_18 = _res_vals[s];
19269                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
19270                 CHECK_ACCESS(_res_conv_18_ptr);
19271                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
19272                 FREE(untag_ptr(_res_conv_18));
19273                 _res_constr.data[s] = _res_conv_18_conv;
19274         }
19275         FREE(_res);
19276         CVec_MessageSendEventZ_free(_res_constr);
19277 }
19278
19279 void  __attribute__((export_name("TS_CVec_ChainHashZ_free"))) TS_CVec_ChainHashZ_free(ptrArray _res) {
19280         LDKCVec_ChainHashZ _res_constr;
19281         _res_constr.datalen = _res->arr_len;
19282         if (_res_constr.datalen > 0)
19283                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
19284         else
19285                 _res_constr.data = NULL;
19286         int8_tArray* _res_vals = (void*) _res->elems;
19287         for (size_t m = 0; m < _res_constr.datalen; m++) {
19288                 int8_tArray _res_conv_12 = _res_vals[m];
19289                 LDKThirtyTwoBytes _res_conv_12_ref;
19290                 CHECK(_res_conv_12->arr_len == 32);
19291                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
19292                 _res_constr.data[m] = _res_conv_12_ref;
19293         }
19294         FREE(_res);
19295         CVec_ChainHashZ_free(_res_constr);
19296 }
19297
19298 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_ok"))) TS_CResult_OfferBolt12ParseErrorZ_ok(uint64_t o) {
19299         LDKOffer o_conv;
19300         o_conv.inner = untag_ptr(o);
19301         o_conv.is_owned = ptr_is_owned(o);
19302         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19303         o_conv = Offer_clone(&o_conv);
19304         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19305         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
19306         return tag_ptr(ret_conv, true);
19307 }
19308
19309 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_err"))) TS_CResult_OfferBolt12ParseErrorZ_err(uint64_t e) {
19310         LDKBolt12ParseError e_conv;
19311         e_conv.inner = untag_ptr(e);
19312         e_conv.is_owned = ptr_is_owned(e);
19313         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19314         e_conv = Bolt12ParseError_clone(&e_conv);
19315         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19316         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
19317         return tag_ptr(ret_conv, true);
19318 }
19319
19320 jboolean  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_is_ok"))) TS_CResult_OfferBolt12ParseErrorZ_is_ok(uint64_t o) {
19321         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
19322         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
19323         return ret_conv;
19324 }
19325
19326 void  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_free"))) TS_CResult_OfferBolt12ParseErrorZ_free(uint64_t _res) {
19327         if (!ptr_is_owned(_res)) return;
19328         void* _res_ptr = untag_ptr(_res);
19329         CHECK_ACCESS(_res_ptr);
19330         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
19331         FREE(untag_ptr(_res));
19332         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
19333 }
19334
19335 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
19336         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19337         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
19338         return tag_ptr(ret_conv, true);
19339 }
19340 int64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone_ptr"))) TS_CResult_OfferBolt12ParseErrorZ_clone_ptr(uint64_t arg) {
19341         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
19342         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
19343         return ret_conv;
19344 }
19345
19346 uint64_t  __attribute__((export_name("TS_CResult_OfferBolt12ParseErrorZ_clone"))) TS_CResult_OfferBolt12ParseErrorZ_clone(uint64_t orig) {
19347         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
19348         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
19349         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
19350         return tag_ptr(ret_conv, true);
19351 }
19352
19353 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) {
19354         LDKPublicKey o_ref;
19355         CHECK(o->arr_len == 33);
19356         memcpy(o_ref.compressed_form, o->elems, 33); FREE(o);
19357         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19358         *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
19359         return tag_ptr(ret_conv, true);
19360 }
19361
19362 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) {
19363         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
19364         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19365         *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
19366         return tag_ptr(ret_conv, true);
19367 }
19368
19369 jboolean  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) {
19370         LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o);
19371         jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv);
19372         return ret_conv;
19373 }
19374
19375 void  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) {
19376         if (!ptr_is_owned(_res)) return;
19377         void* _res_ptr = untag_ptr(_res);
19378         CHECK_ACCESS(_res_ptr);
19379         LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr);
19380         FREE(untag_ptr(_res));
19381         CResult_PublicKeyErrorZ_free(_res_conv);
19382 }
19383
19384 static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) {
19385         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19386         *ret_conv = CResult_PublicKeyErrorZ_clone(arg);
19387         return tag_ptr(ret_conv, true);
19388 }
19389 int64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) {
19390         LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg);
19391         int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv);
19392         return ret_conv;
19393 }
19394
19395 uint64_t  __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) {
19396         LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig);
19397         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
19398         *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
19399         return tag_ptr(ret_conv, true);
19400 }
19401
19402 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) {
19403         LDKNodeId o_conv;
19404         o_conv.inner = untag_ptr(o);
19405         o_conv.is_owned = ptr_is_owned(o);
19406         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19407         o_conv = NodeId_clone(&o_conv);
19408         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19409         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
19410         return tag_ptr(ret_conv, true);
19411 }
19412
19413 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_err"))) TS_CResult_NodeIdDecodeErrorZ_err(uint64_t e) {
19414         void* e_ptr = untag_ptr(e);
19415         CHECK_ACCESS(e_ptr);
19416         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19417         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19418         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19419         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
19420         return tag_ptr(ret_conv, true);
19421 }
19422
19423 jboolean  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_is_ok"))) TS_CResult_NodeIdDecodeErrorZ_is_ok(uint64_t o) {
19424         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
19425         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
19426         return ret_conv;
19427 }
19428
19429 void  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_free"))) TS_CResult_NodeIdDecodeErrorZ_free(uint64_t _res) {
19430         if (!ptr_is_owned(_res)) return;
19431         void* _res_ptr = untag_ptr(_res);
19432         CHECK_ACCESS(_res_ptr);
19433         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
19434         FREE(untag_ptr(_res));
19435         CResult_NodeIdDecodeErrorZ_free(_res_conv);
19436 }
19437
19438 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
19439         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19440         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
19441         return tag_ptr(ret_conv, true);
19442 }
19443 int64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone_ptr"))) TS_CResult_NodeIdDecodeErrorZ_clone_ptr(uint64_t arg) {
19444         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
19445         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
19446         return ret_conv;
19447 }
19448
19449 uint64_t  __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_clone"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint64_t orig) {
19450         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
19451         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
19452         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
19453         return tag_ptr(ret_conv, true);
19454 }
19455
19456 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_ok(uint64_t o) {
19457         void* o_ptr = untag_ptr(o);
19458         CHECK_ACCESS(o_ptr);
19459         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
19460         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
19461         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19462         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
19463         return tag_ptr(ret_conv, true);
19464 }
19465
19466 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_err(uint64_t e) {
19467         void* e_ptr = untag_ptr(e);
19468         CHECK_ACCESS(e_ptr);
19469         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19470         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19471         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19472         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
19473         return tag_ptr(ret_conv, true);
19474 }
19475
19476 jboolean  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(uint64_t o) {
19477         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
19478         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
19479         return ret_conv;
19480 }
19481
19482 void  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_free(uint64_t _res) {
19483         if (!ptr_is_owned(_res)) return;
19484         void* _res_ptr = untag_ptr(_res);
19485         CHECK_ACCESS(_res_ptr);
19486         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
19487         FREE(untag_ptr(_res));
19488         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
19489 }
19490
19491 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
19492         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19493         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
19494         return tag_ptr(ret_conv, true);
19495 }
19496 int64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(uint64_t arg) {
19497         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
19498         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
19499         return ret_conv;
19500 }
19501
19502 uint64_t  __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone"))) TS_CResult_COption_NetworkUpdateZDecodeErrorZ_clone(uint64_t orig) {
19503         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
19504         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
19505         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
19506         return tag_ptr(ret_conv, true);
19507 }
19508
19509 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) {
19510         void* o_ptr = untag_ptr(o);
19511         CHECK_ACCESS(o_ptr);
19512         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
19513         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
19514                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
19515                 LDKUtxoLookup_JCalls_cloned(&o_conv);
19516         }
19517         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19518         *ret_copy = COption_UtxoLookupZ_some(o_conv);
19519         uint64_t ret_ref = tag_ptr(ret_copy, true);
19520         return ret_ref;
19521 }
19522
19523 uint64_t  __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() {
19524         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
19525         *ret_copy = COption_UtxoLookupZ_none();
19526         uint64_t ret_ref = tag_ptr(ret_copy, true);
19527         return ret_ref;
19528 }
19529
19530 void  __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) {
19531         if (!ptr_is_owned(_res)) return;
19532         void* _res_ptr = untag_ptr(_res);
19533         CHECK_ACCESS(_res_ptr);
19534         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
19535         FREE(untag_ptr(_res));
19536         COption_UtxoLookupZ_free(_res_conv);
19537 }
19538
19539 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_ok"))) TS_CResult_NoneLightningErrorZ_ok() {
19540         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19541         *ret_conv = CResult_NoneLightningErrorZ_ok();
19542         return tag_ptr(ret_conv, true);
19543 }
19544
19545 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_err"))) TS_CResult_NoneLightningErrorZ_err(uint64_t e) {
19546         LDKLightningError e_conv;
19547         e_conv.inner = untag_ptr(e);
19548         e_conv.is_owned = ptr_is_owned(e);
19549         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19550         e_conv = LightningError_clone(&e_conv);
19551         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19552         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
19553         return tag_ptr(ret_conv, true);
19554 }
19555
19556 jboolean  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_is_ok"))) TS_CResult_NoneLightningErrorZ_is_ok(uint64_t o) {
19557         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
19558         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
19559         return ret_conv;
19560 }
19561
19562 void  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_free"))) TS_CResult_NoneLightningErrorZ_free(uint64_t _res) {
19563         if (!ptr_is_owned(_res)) return;
19564         void* _res_ptr = untag_ptr(_res);
19565         CHECK_ACCESS(_res_ptr);
19566         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
19567         FREE(untag_ptr(_res));
19568         CResult_NoneLightningErrorZ_free(_res_conv);
19569 }
19570
19571 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
19572         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19573         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
19574         return tag_ptr(ret_conv, true);
19575 }
19576 int64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone_ptr"))) TS_CResult_NoneLightningErrorZ_clone_ptr(uint64_t arg) {
19577         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
19578         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
19579         return ret_conv;
19580 }
19581
19582 uint64_t  __attribute__((export_name("TS_CResult_NoneLightningErrorZ_clone"))) TS_CResult_NoneLightningErrorZ_clone(uint64_t orig) {
19583         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
19584         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
19585         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
19586         return tag_ptr(ret_conv, true);
19587 }
19588
19589 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
19590         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19591         *ret_conv = CResult_boolLightningErrorZ_ok(o);
19592         return tag_ptr(ret_conv, true);
19593 }
19594
19595 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_err"))) TS_CResult_boolLightningErrorZ_err(uint64_t e) {
19596         LDKLightningError e_conv;
19597         e_conv.inner = untag_ptr(e);
19598         e_conv.is_owned = ptr_is_owned(e);
19599         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
19600         e_conv = LightningError_clone(&e_conv);
19601         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19602         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
19603         return tag_ptr(ret_conv, true);
19604 }
19605
19606 jboolean  __attribute__((export_name("TS_CResult_boolLightningErrorZ_is_ok"))) TS_CResult_boolLightningErrorZ_is_ok(uint64_t o) {
19607         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
19608         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
19609         return ret_conv;
19610 }
19611
19612 void  __attribute__((export_name("TS_CResult_boolLightningErrorZ_free"))) TS_CResult_boolLightningErrorZ_free(uint64_t _res) {
19613         if (!ptr_is_owned(_res)) return;
19614         void* _res_ptr = untag_ptr(_res);
19615         CHECK_ACCESS(_res_ptr);
19616         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
19617         FREE(untag_ptr(_res));
19618         CResult_boolLightningErrorZ_free(_res_conv);
19619 }
19620
19621 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
19622         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19623         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
19624         return tag_ptr(ret_conv, true);
19625 }
19626 int64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone_ptr"))) TS_CResult_boolLightningErrorZ_clone_ptr(uint64_t arg) {
19627         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
19628         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
19629         return ret_conv;
19630 }
19631
19632 uint64_t  __attribute__((export_name("TS_CResult_boolLightningErrorZ_clone"))) TS_CResult_boolLightningErrorZ_clone(uint64_t orig) {
19633         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
19634         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
19635         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
19636         return tag_ptr(ret_conv, true);
19637 }
19638
19639 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
19640         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19641         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
19642         return tag_ptr(ret_conv, true);
19643 }
19644 int64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(uint64_t arg) {
19645         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
19646         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
19647         return ret_conv;
19648 }
19649
19650 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint64_t orig) {
19651         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
19652         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19653         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
19654         return tag_ptr(ret_conv, true);
19655 }
19656
19657 uint64_t  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint64_t a, uint64_t b, uint64_t c) {
19658         LDKChannelAnnouncement a_conv;
19659         a_conv.inner = untag_ptr(a);
19660         a_conv.is_owned = ptr_is_owned(a);
19661         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
19662         a_conv = ChannelAnnouncement_clone(&a_conv);
19663         LDKChannelUpdate b_conv;
19664         b_conv.inner = untag_ptr(b);
19665         b_conv.is_owned = ptr_is_owned(b);
19666         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
19667         b_conv = ChannelUpdate_clone(&b_conv);
19668         LDKChannelUpdate c_conv;
19669         c_conv.inner = untag_ptr(c);
19670         c_conv.is_owned = ptr_is_owned(c);
19671         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
19672         c_conv = ChannelUpdate_clone(&c_conv);
19673         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
19674         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
19675         return tag_ptr(ret_conv, true);
19676 }
19677
19678 void  __attribute__((export_name("TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(uint64_t _res) {
19679         if (!ptr_is_owned(_res)) return;
19680         void* _res_ptr = untag_ptr(_res);
19681         CHECK_ACCESS(_res_ptr);
19682         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
19683         FREE(untag_ptr(_res));
19684         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
19685 }
19686
19687 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(uint64_t o) {
19688         void* o_ptr = untag_ptr(o);
19689         CHECK_ACCESS(o_ptr);
19690         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
19691         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
19692         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19693         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
19694         uint64_t ret_ref = tag_ptr(ret_copy, true);
19695         return ret_ref;
19696 }
19697
19698 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() {
19699         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19700         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
19701         uint64_t ret_ref = tag_ptr(ret_copy, true);
19702         return ret_ref;
19703 }
19704
19705 void  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(uint64_t _res) {
19706         if (!ptr_is_owned(_res)) return;
19707         void* _res_ptr = untag_ptr(_res);
19708         CHECK_ACCESS(_res_ptr);
19709         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
19710         FREE(untag_ptr(_res));
19711         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
19712 }
19713
19714 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
19715         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19716         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
19717         uint64_t ret_ref = tag_ptr(ret_copy, true);
19718         return ret_ref;
19719 }
19720 int64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(uint64_t arg) {
19721         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
19722         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
19723         return ret_conv;
19724 }
19725
19726 uint64_t  __attribute__((export_name("TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone"))) TS_COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(uint64_t orig) {
19727         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
19728         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
19729         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
19730         uint64_t ret_ref = tag_ptr(ret_copy, true);
19731         return ret_ref;
19732 }
19733
19734 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_ok(uint64_t o) {
19735         LDKChannelUpdateInfo o_conv;
19736         o_conv.inner = untag_ptr(o);
19737         o_conv.is_owned = ptr_is_owned(o);
19738         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19739         o_conv = ChannelUpdateInfo_clone(&o_conv);
19740         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19741         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
19742         return tag_ptr(ret_conv, true);
19743 }
19744
19745 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_err"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_err(uint64_t e) {
19746         void* e_ptr = untag_ptr(e);
19747         CHECK_ACCESS(e_ptr);
19748         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19749         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19750         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19751         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
19752         return tag_ptr(ret_conv, true);
19753 }
19754
19755 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(uint64_t o) {
19756         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
19757         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
19758         return ret_conv;
19759 }
19760
19761 void  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_free"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_free(uint64_t _res) {
19762         if (!ptr_is_owned(_res)) return;
19763         void* _res_ptr = untag_ptr(_res);
19764         CHECK_ACCESS(_res_ptr);
19765         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
19766         FREE(untag_ptr(_res));
19767         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
19768 }
19769
19770 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
19771         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19772         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
19773         return tag_ptr(ret_conv, true);
19774 }
19775 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19776         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
19777         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
19778         return ret_conv;
19779 }
19780
19781 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateInfoDecodeErrorZ_clone(uint64_t orig) {
19782         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
19783         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
19784         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
19785         return tag_ptr(ret_conv, true);
19786 }
19787
19788 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_ok(uint64_t o) {
19789         LDKChannelInfo o_conv;
19790         o_conv.inner = untag_ptr(o);
19791         o_conv.is_owned = ptr_is_owned(o);
19792         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19793         o_conv = ChannelInfo_clone(&o_conv);
19794         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19795         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
19796         return tag_ptr(ret_conv, true);
19797 }
19798
19799 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_err"))) TS_CResult_ChannelInfoDecodeErrorZ_err(uint64_t e) {
19800         void* e_ptr = untag_ptr(e);
19801         CHECK_ACCESS(e_ptr);
19802         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19803         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19804         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19805         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
19806         return tag_ptr(ret_conv, true);
19807 }
19808
19809 jboolean  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_is_ok"))) TS_CResult_ChannelInfoDecodeErrorZ_is_ok(uint64_t o) {
19810         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
19811         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
19812         return ret_conv;
19813 }
19814
19815 void  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_free"))) TS_CResult_ChannelInfoDecodeErrorZ_free(uint64_t _res) {
19816         if (!ptr_is_owned(_res)) return;
19817         void* _res_ptr = untag_ptr(_res);
19818         CHECK_ACCESS(_res_ptr);
19819         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
19820         FREE(untag_ptr(_res));
19821         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
19822 }
19823
19824 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
19825         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19826         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
19827         return tag_ptr(ret_conv, true);
19828 }
19829 int64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19830         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
19831         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
19832         return ret_conv;
19833 }
19834
19835 uint64_t  __attribute__((export_name("TS_CResult_ChannelInfoDecodeErrorZ_clone"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint64_t orig) {
19836         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
19837         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
19838         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
19839         return tag_ptr(ret_conv, true);
19840 }
19841
19842 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint64_t o) {
19843         LDKRoutingFees o_conv;
19844         o_conv.inner = untag_ptr(o);
19845         o_conv.is_owned = ptr_is_owned(o);
19846         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19847         o_conv = RoutingFees_clone(&o_conv);
19848         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19849         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
19850         return tag_ptr(ret_conv, true);
19851 }
19852
19853 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_err"))) TS_CResult_RoutingFeesDecodeErrorZ_err(uint64_t e) {
19854         void* e_ptr = untag_ptr(e);
19855         CHECK_ACCESS(e_ptr);
19856         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19857         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19858         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19859         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
19860         return tag_ptr(ret_conv, true);
19861 }
19862
19863 jboolean  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_is_ok"))) TS_CResult_RoutingFeesDecodeErrorZ_is_ok(uint64_t o) {
19864         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
19865         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
19866         return ret_conv;
19867 }
19868
19869 void  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_free"))) TS_CResult_RoutingFeesDecodeErrorZ_free(uint64_t _res) {
19870         if (!ptr_is_owned(_res)) return;
19871         void* _res_ptr = untag_ptr(_res);
19872         CHECK_ACCESS(_res_ptr);
19873         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
19874         FREE(untag_ptr(_res));
19875         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
19876 }
19877
19878 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
19879         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19880         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
19881         return tag_ptr(ret_conv, true);
19882 }
19883 int64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr"))) TS_CResult_RoutingFeesDecodeErrorZ_clone_ptr(uint64_t arg) {
19884         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
19885         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
19886         return ret_conv;
19887 }
19888
19889 uint64_t  __attribute__((export_name("TS_CResult_RoutingFeesDecodeErrorZ_clone"))) TS_CResult_RoutingFeesDecodeErrorZ_clone(uint64_t orig) {
19890         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
19891         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
19892         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
19893         return tag_ptr(ret_conv, true);
19894 }
19895
19896 void  __attribute__((export_name("TS_CVec_NetAddressZ_free"))) TS_CVec_NetAddressZ_free(uint64_tArray _res) {
19897         LDKCVec_NetAddressZ _res_constr;
19898         _res_constr.datalen = _res->arr_len;
19899         if (_res_constr.datalen > 0)
19900                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19901         else
19902                 _res_constr.data = NULL;
19903         uint64_t* _res_vals = _res->elems;
19904         for (size_t m = 0; m < _res_constr.datalen; m++) {
19905                 uint64_t _res_conv_12 = _res_vals[m];
19906                 void* _res_conv_12_ptr = untag_ptr(_res_conv_12);
19907                 CHECK_ACCESS(_res_conv_12_ptr);
19908                 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(_res_conv_12_ptr);
19909                 FREE(untag_ptr(_res_conv_12));
19910                 _res_constr.data[m] = _res_conv_12_conv;
19911         }
19912         FREE(_res);
19913         CVec_NetAddressZ_free(_res_constr);
19914 }
19915
19916 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_ok(uint64_t o) {
19917         LDKNodeAnnouncementInfo o_conv;
19918         o_conv.inner = untag_ptr(o);
19919         o_conv.is_owned = ptr_is_owned(o);
19920         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19921         o_conv = NodeAnnouncementInfo_clone(&o_conv);
19922         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19923         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
19924         return tag_ptr(ret_conv, true);
19925 }
19926
19927 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_err(uint64_t e) {
19928         void* e_ptr = untag_ptr(e);
19929         CHECK_ACCESS(e_ptr);
19930         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19931         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19932         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19933         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
19934         return tag_ptr(ret_conv, true);
19935 }
19936
19937 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(uint64_t o) {
19938         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
19939         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
19940         return ret_conv;
19941 }
19942
19943 void  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_free(uint64_t _res) {
19944         if (!ptr_is_owned(_res)) return;
19945         void* _res_ptr = untag_ptr(_res);
19946         CHECK_ACCESS(_res_ptr);
19947         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
19948         FREE(untag_ptr(_res));
19949         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
19950 }
19951
19952 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
19953         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19954         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
19955         return tag_ptr(ret_conv, true);
19956 }
19957 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
19958         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
19959         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
19960         return ret_conv;
19961 }
19962
19963 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementInfoDecodeErrorZ_clone(uint64_t orig) {
19964         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
19965         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
19966         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
19967         return tag_ptr(ret_conv, true);
19968 }
19969
19970 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_ok"))) TS_CResult_NodeAliasDecodeErrorZ_ok(uint64_t o) {
19971         LDKNodeAlias o_conv;
19972         o_conv.inner = untag_ptr(o);
19973         o_conv.is_owned = ptr_is_owned(o);
19974         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
19975         o_conv = NodeAlias_clone(&o_conv);
19976         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19977         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
19978         return tag_ptr(ret_conv, true);
19979 }
19980
19981 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_err"))) TS_CResult_NodeAliasDecodeErrorZ_err(uint64_t e) {
19982         void* e_ptr = untag_ptr(e);
19983         CHECK_ACCESS(e_ptr);
19984         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
19985         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
19986         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
19987         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
19988         return tag_ptr(ret_conv, true);
19989 }
19990
19991 jboolean  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_is_ok"))) TS_CResult_NodeAliasDecodeErrorZ_is_ok(uint64_t o) {
19992         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
19993         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
19994         return ret_conv;
19995 }
19996
19997 void  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_free"))) TS_CResult_NodeAliasDecodeErrorZ_free(uint64_t _res) {
19998         if (!ptr_is_owned(_res)) return;
19999         void* _res_ptr = untag_ptr(_res);
20000         CHECK_ACCESS(_res_ptr);
20001         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
20002         FREE(untag_ptr(_res));
20003         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
20004 }
20005
20006 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
20007         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
20008         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
20009         return tag_ptr(ret_conv, true);
20010 }
20011 int64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAliasDecodeErrorZ_clone_ptr(uint64_t arg) {
20012         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
20013         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
20014         return ret_conv;
20015 }
20016
20017 uint64_t  __attribute__((export_name("TS_CResult_NodeAliasDecodeErrorZ_clone"))) TS_CResult_NodeAliasDecodeErrorZ_clone(uint64_t orig) {
20018         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
20019         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
20020         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
20021         return tag_ptr(ret_conv, true);
20022 }
20023
20024 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_ok"))) TS_CResult_NodeInfoDecodeErrorZ_ok(uint64_t o) {
20025         LDKNodeInfo o_conv;
20026         o_conv.inner = untag_ptr(o);
20027         o_conv.is_owned = ptr_is_owned(o);
20028         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20029         o_conv = NodeInfo_clone(&o_conv);
20030         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20031         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
20032         return tag_ptr(ret_conv, true);
20033 }
20034
20035 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_err"))) TS_CResult_NodeInfoDecodeErrorZ_err(uint64_t e) {
20036         void* e_ptr = untag_ptr(e);
20037         CHECK_ACCESS(e_ptr);
20038         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20039         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20040         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20041         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
20042         return tag_ptr(ret_conv, true);
20043 }
20044
20045 jboolean  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_is_ok"))) TS_CResult_NodeInfoDecodeErrorZ_is_ok(uint64_t o) {
20046         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
20047         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
20048         return ret_conv;
20049 }
20050
20051 void  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_free"))) TS_CResult_NodeInfoDecodeErrorZ_free(uint64_t _res) {
20052         if (!ptr_is_owned(_res)) return;
20053         void* _res_ptr = untag_ptr(_res);
20054         CHECK_ACCESS(_res_ptr);
20055         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
20056         FREE(untag_ptr(_res));
20057         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
20058 }
20059
20060 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
20061         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20062         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
20063         return tag_ptr(ret_conv, true);
20064 }
20065 int64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone_ptr"))) TS_CResult_NodeInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
20066         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
20067         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
20068         return ret_conv;
20069 }
20070
20071 uint64_t  __attribute__((export_name("TS_CResult_NodeInfoDecodeErrorZ_clone"))) TS_CResult_NodeInfoDecodeErrorZ_clone(uint64_t orig) {
20072         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
20073         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
20074         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
20075         return tag_ptr(ret_conv, true);
20076 }
20077
20078 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_ok(uint64_t o) {
20079         LDKNetworkGraph o_conv;
20080         o_conv.inner = untag_ptr(o);
20081         o_conv.is_owned = ptr_is_owned(o);
20082         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20083         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
20084         
20085         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20086         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
20087         return tag_ptr(ret_conv, true);
20088 }
20089
20090 uint64_t  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_err"))) TS_CResult_NetworkGraphDecodeErrorZ_err(uint64_t e) {
20091         void* e_ptr = untag_ptr(e);
20092         CHECK_ACCESS(e_ptr);
20093         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
20094         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
20095         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
20096         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
20097         return tag_ptr(ret_conv, true);
20098 }
20099
20100 jboolean  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_is_ok"))) TS_CResult_NetworkGraphDecodeErrorZ_is_ok(uint64_t o) {
20101         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
20102         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
20103         return ret_conv;
20104 }
20105
20106 void  __attribute__((export_name("TS_CResult_NetworkGraphDecodeErrorZ_free"))) TS_CResult_NetworkGraphDecodeErrorZ_free(uint64_t _res) {
20107         if (!ptr_is_owned(_res)) return;
20108         void* _res_ptr = untag_ptr(_res);
20109         CHECK_ACCESS(_res_ptr);
20110         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
20111         FREE(untag_ptr(_res));
20112         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
20113 }
20114
20115 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_some"))) TS_COption_CVec_NetAddressZZ_some(uint64_tArray o) {
20116         LDKCVec_NetAddressZ o_constr;
20117         o_constr.datalen = o->arr_len;
20118         if (o_constr.datalen > 0)
20119                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
20120         else
20121                 o_constr.data = NULL;
20122         uint64_t* o_vals = o->elems;
20123         for (size_t m = 0; m < o_constr.datalen; m++) {
20124                 uint64_t o_conv_12 = o_vals[m];
20125                 void* o_conv_12_ptr = untag_ptr(o_conv_12);
20126                 CHECK_ACCESS(o_conv_12_ptr);
20127                 LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(o_conv_12_ptr);
20128                 o_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o_conv_12));
20129                 o_constr.data[m] = o_conv_12_conv;
20130         }
20131         FREE(o);
20132         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20133         *ret_copy = COption_CVec_NetAddressZZ_some(o_constr);
20134         uint64_t ret_ref = tag_ptr(ret_copy, true);
20135         return ret_ref;
20136 }
20137
20138 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_none"))) TS_COption_CVec_NetAddressZZ_none() {
20139         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20140         *ret_copy = COption_CVec_NetAddressZZ_none();
20141         uint64_t ret_ref = tag_ptr(ret_copy, true);
20142         return ret_ref;
20143 }
20144
20145 void  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_free"))) TS_COption_CVec_NetAddressZZ_free(uint64_t _res) {
20146         if (!ptr_is_owned(_res)) return;
20147         void* _res_ptr = untag_ptr(_res);
20148         CHECK_ACCESS(_res_ptr);
20149         LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(_res_ptr);
20150         FREE(untag_ptr(_res));
20151         COption_CVec_NetAddressZZ_free(_res_conv);
20152 }
20153
20154 static inline uint64_t COption_CVec_NetAddressZZ_clone_ptr(LDKCOption_CVec_NetAddressZZ *NONNULL_PTR arg) {
20155         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20156         *ret_copy = COption_CVec_NetAddressZZ_clone(arg);
20157         uint64_t ret_ref = tag_ptr(ret_copy, true);
20158         return ret_ref;
20159 }
20160 int64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone_ptr"))) TS_COption_CVec_NetAddressZZ_clone_ptr(uint64_t arg) {
20161         LDKCOption_CVec_NetAddressZZ* arg_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(arg);
20162         int64_t ret_conv = COption_CVec_NetAddressZZ_clone_ptr(arg_conv);
20163         return ret_conv;
20164 }
20165
20166 uint64_t  __attribute__((export_name("TS_COption_CVec_NetAddressZZ_clone"))) TS_COption_CVec_NetAddressZZ_clone(uint64_t orig) {
20167         LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)untag_ptr(orig);
20168         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
20169         *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv);
20170         uint64_t ret_ref = tag_ptr(ret_copy, true);
20171         return ret_ref;
20172 }
20173
20174 void  __attribute__((export_name("TS_CVec_HTLCOutputInCommitmentZ_free"))) TS_CVec_HTLCOutputInCommitmentZ_free(uint64_tArray _res) {
20175         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
20176         _res_constr.datalen = _res->arr_len;
20177         if (_res_constr.datalen > 0)
20178                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
20179         else
20180                 _res_constr.data = NULL;
20181         uint64_t* _res_vals = _res->elems;
20182         for (size_t y = 0; y < _res_constr.datalen; y++) {
20183                 uint64_t _res_conv_24 = _res_vals[y];
20184                 LDKHTLCOutputInCommitment _res_conv_24_conv;
20185                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
20186                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
20187                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
20188                 _res_constr.data[y] = _res_conv_24_conv;
20189         }
20190         FREE(_res);
20191         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
20192 }
20193
20194 void  __attribute__((export_name("TS_CVec_HTLCDescriptorZ_free"))) TS_CVec_HTLCDescriptorZ_free(uint64_tArray _res) {
20195         LDKCVec_HTLCDescriptorZ _res_constr;
20196         _res_constr.datalen = _res->arr_len;
20197         if (_res_constr.datalen > 0)
20198                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
20199         else
20200                 _res_constr.data = NULL;
20201         uint64_t* _res_vals = _res->elems;
20202         for (size_t q = 0; q < _res_constr.datalen; q++) {
20203                 uint64_t _res_conv_16 = _res_vals[q];
20204                 LDKHTLCDescriptor _res_conv_16_conv;
20205                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
20206                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
20207                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
20208                 _res_constr.data[q] = _res_conv_16_conv;
20209         }
20210         FREE(_res);
20211         CVec_HTLCDescriptorZ_free(_res_constr);
20212 }
20213
20214 void  __attribute__((export_name("TS_CVec_UtxoZ_free"))) TS_CVec_UtxoZ_free(uint64_tArray _res) {
20215         LDKCVec_UtxoZ _res_constr;
20216         _res_constr.datalen = _res->arr_len;
20217         if (_res_constr.datalen > 0)
20218                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
20219         else
20220                 _res_constr.data = NULL;
20221         uint64_t* _res_vals = _res->elems;
20222         for (size_t g = 0; g < _res_constr.datalen; g++) {
20223                 uint64_t _res_conv_6 = _res_vals[g];
20224                 LDKUtxo _res_conv_6_conv;
20225                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
20226                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
20227                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
20228                 _res_constr.data[g] = _res_conv_6_conv;
20229         }
20230         FREE(_res);
20231         CVec_UtxoZ_free(_res_constr);
20232 }
20233
20234 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_some"))) TS_COption_TxOutZ_some(uint64_t o) {
20235         void* o_ptr = untag_ptr(o);
20236         CHECK_ACCESS(o_ptr);
20237         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
20238         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
20239         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20240         *ret_copy = COption_TxOutZ_some(o_conv);
20241         uint64_t ret_ref = tag_ptr(ret_copy, true);
20242         return ret_ref;
20243 }
20244
20245 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_none"))) TS_COption_TxOutZ_none() {
20246         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20247         *ret_copy = COption_TxOutZ_none();
20248         uint64_t ret_ref = tag_ptr(ret_copy, true);
20249         return ret_ref;
20250 }
20251
20252 void  __attribute__((export_name("TS_COption_TxOutZ_free"))) TS_COption_TxOutZ_free(uint64_t _res) {
20253         if (!ptr_is_owned(_res)) return;
20254         void* _res_ptr = untag_ptr(_res);
20255         CHECK_ACCESS(_res_ptr);
20256         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
20257         FREE(untag_ptr(_res));
20258         COption_TxOutZ_free(_res_conv);
20259 }
20260
20261 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
20262         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20263         *ret_copy = COption_TxOutZ_clone(arg);
20264         uint64_t ret_ref = tag_ptr(ret_copy, true);
20265         return ret_ref;
20266 }
20267 int64_t  __attribute__((export_name("TS_COption_TxOutZ_clone_ptr"))) TS_COption_TxOutZ_clone_ptr(uint64_t arg) {
20268         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
20269         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
20270         return ret_conv;
20271 }
20272
20273 uint64_t  __attribute__((export_name("TS_COption_TxOutZ_clone"))) TS_COption_TxOutZ_clone(uint64_t orig) {
20274         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
20275         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
20276         *ret_copy = COption_TxOutZ_clone(orig_conv);
20277         uint64_t ret_ref = tag_ptr(ret_copy, true);
20278         return ret_ref;
20279 }
20280
20281 void  __attribute__((export_name("TS_CVec_InputZ_free"))) TS_CVec_InputZ_free(uint64_tArray _res) {
20282         LDKCVec_InputZ _res_constr;
20283         _res_constr.datalen = _res->arr_len;
20284         if (_res_constr.datalen > 0)
20285                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
20286         else
20287                 _res_constr.data = NULL;
20288         uint64_t* _res_vals = _res->elems;
20289         for (size_t h = 0; h < _res_constr.datalen; h++) {
20290                 uint64_t _res_conv_7 = _res_vals[h];
20291                 LDKInput _res_conv_7_conv;
20292                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
20293                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
20294                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
20295                 _res_constr.data[h] = _res_conv_7_conv;
20296         }
20297         FREE(_res);
20298         CVec_InputZ_free(_res_constr);
20299 }
20300
20301 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_ok"))) TS_CResult_CoinSelectionNoneZ_ok(uint64_t o) {
20302         LDKCoinSelection o_conv;
20303         o_conv.inner = untag_ptr(o);
20304         o_conv.is_owned = ptr_is_owned(o);
20305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
20306         o_conv = CoinSelection_clone(&o_conv);
20307         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20308         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
20309         return tag_ptr(ret_conv, true);
20310 }
20311
20312 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_err"))) TS_CResult_CoinSelectionNoneZ_err() {
20313         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20314         *ret_conv = CResult_CoinSelectionNoneZ_err();
20315         return tag_ptr(ret_conv, true);
20316 }
20317
20318 jboolean  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_is_ok"))) TS_CResult_CoinSelectionNoneZ_is_ok(uint64_t o) {
20319         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
20320         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
20321         return ret_conv;
20322 }
20323
20324 void  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_free"))) TS_CResult_CoinSelectionNoneZ_free(uint64_t _res) {
20325         if (!ptr_is_owned(_res)) return;
20326         void* _res_ptr = untag_ptr(_res);
20327         CHECK_ACCESS(_res_ptr);
20328         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
20329         FREE(untag_ptr(_res));
20330         CResult_CoinSelectionNoneZ_free(_res_conv);
20331 }
20332
20333 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
20334         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20335         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
20336         return tag_ptr(ret_conv, true);
20337 }
20338 int64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone_ptr"))) TS_CResult_CoinSelectionNoneZ_clone_ptr(uint64_t arg) {
20339         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
20340         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
20341         return ret_conv;
20342 }
20343
20344 uint64_t  __attribute__((export_name("TS_CResult_CoinSelectionNoneZ_clone"))) TS_CResult_CoinSelectionNoneZ_clone(uint64_t orig) {
20345         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
20346         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
20347         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
20348         return tag_ptr(ret_conv, true);
20349 }
20350
20351 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_ok"))) TS_CResult_CVec_UtxoZNoneZ_ok(uint64_tArray o) {
20352         LDKCVec_UtxoZ o_constr;
20353         o_constr.datalen = o->arr_len;
20354         if (o_constr.datalen > 0)
20355                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
20356         else
20357                 o_constr.data = NULL;
20358         uint64_t* o_vals = o->elems;
20359         for (size_t g = 0; g < o_constr.datalen; g++) {
20360                 uint64_t o_conv_6 = o_vals[g];
20361                 LDKUtxo o_conv_6_conv;
20362                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
20363                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
20364                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
20365                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
20366                 o_constr.data[g] = o_conv_6_conv;
20367         }
20368         FREE(o);
20369         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20370         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
20371         return tag_ptr(ret_conv, true);
20372 }
20373
20374 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_err"))) TS_CResult_CVec_UtxoZNoneZ_err() {
20375         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20376         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
20377         return tag_ptr(ret_conv, true);
20378 }
20379
20380 jboolean  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_is_ok"))) TS_CResult_CVec_UtxoZNoneZ_is_ok(uint64_t o) {
20381         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
20382         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
20383         return ret_conv;
20384 }
20385
20386 void  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_free"))) TS_CResult_CVec_UtxoZNoneZ_free(uint64_t _res) {
20387         if (!ptr_is_owned(_res)) return;
20388         void* _res_ptr = untag_ptr(_res);
20389         CHECK_ACCESS(_res_ptr);
20390         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
20391         FREE(untag_ptr(_res));
20392         CResult_CVec_UtxoZNoneZ_free(_res_conv);
20393 }
20394
20395 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
20396         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20397         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
20398         return tag_ptr(ret_conv, true);
20399 }
20400 int64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone_ptr"))) TS_CResult_CVec_UtxoZNoneZ_clone_ptr(uint64_t arg) {
20401         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
20402         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
20403         return ret_conv;
20404 }
20405
20406 uint64_t  __attribute__((export_name("TS_CResult_CVec_UtxoZNoneZ_clone"))) TS_CResult_CVec_UtxoZNoneZ_clone(uint64_t orig) {
20407         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
20408         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
20409         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
20410         return tag_ptr(ret_conv, true);
20411 }
20412
20413 uint64_t  __attribute__((export_name("TS_COption_u16Z_some"))) TS_COption_u16Z_some(int16_t o) {
20414         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20415         *ret_copy = COption_u16Z_some(o);
20416         uint64_t ret_ref = tag_ptr(ret_copy, true);
20417         return ret_ref;
20418 }
20419
20420 uint64_t  __attribute__((export_name("TS_COption_u16Z_none"))) TS_COption_u16Z_none() {
20421         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20422         *ret_copy = COption_u16Z_none();
20423         uint64_t ret_ref = tag_ptr(ret_copy, true);
20424         return ret_ref;
20425 }
20426
20427 void  __attribute__((export_name("TS_COption_u16Z_free"))) TS_COption_u16Z_free(uint64_t _res) {
20428         if (!ptr_is_owned(_res)) return;
20429         void* _res_ptr = untag_ptr(_res);
20430         CHECK_ACCESS(_res_ptr);
20431         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
20432         FREE(untag_ptr(_res));
20433         COption_u16Z_free(_res_conv);
20434 }
20435
20436 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
20437         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20438         *ret_copy = COption_u16Z_clone(arg);
20439         uint64_t ret_ref = tag_ptr(ret_copy, true);
20440         return ret_ref;
20441 }
20442 int64_t  __attribute__((export_name("TS_COption_u16Z_clone_ptr"))) TS_COption_u16Z_clone_ptr(uint64_t arg) {
20443         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
20444         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
20445         return ret_conv;
20446 }
20447
20448 uint64_t  __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_clone(uint64_t orig) {
20449         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
20450         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
20451         *ret_copy = COption_u16Z_clone(orig_conv);
20452         uint64_t ret_ref = tag_ptr(ret_copy, true);
20453         return ret_ref;
20454 }
20455
20456 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_some"))) TS_COption_ChannelShutdownStateZ_some(uint32_t o) {
20457         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
20458         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20459         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
20460         uint64_t ret_ref = tag_ptr(ret_copy, true);
20461         return ret_ref;
20462 }
20463
20464 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_none"))) TS_COption_ChannelShutdownStateZ_none() {
20465         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20466         *ret_copy = COption_ChannelShutdownStateZ_none();
20467         uint64_t ret_ref = tag_ptr(ret_copy, true);
20468         return ret_ref;
20469 }
20470
20471 void  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_free"))) TS_COption_ChannelShutdownStateZ_free(uint64_t _res) {
20472         if (!ptr_is_owned(_res)) return;
20473         void* _res_ptr = untag_ptr(_res);
20474         CHECK_ACCESS(_res_ptr);
20475         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
20476         FREE(untag_ptr(_res));
20477         COption_ChannelShutdownStateZ_free(_res_conv);
20478 }
20479
20480 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
20481         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20482         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
20483         uint64_t ret_ref = tag_ptr(ret_copy, true);
20484         return ret_ref;
20485 }
20486 int64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone_ptr"))) TS_COption_ChannelShutdownStateZ_clone_ptr(uint64_t arg) {
20487         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
20488         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
20489         return ret_conv;
20490 }
20491
20492 uint64_t  __attribute__((export_name("TS_COption_ChannelShutdownStateZ_clone"))) TS_COption_ChannelShutdownStateZ_clone(uint64_t orig) {
20493         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
20494         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
20495         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
20496         uint64_t ret_ref = tag_ptr(ret_copy, true);
20497         return ret_ref;
20498 }
20499
20500 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) {
20501         LDKThirtyTwoBytes o_ref;
20502         CHECK(o->arr_len == 32);
20503         memcpy(o_ref.data, o->elems, 32); FREE(o);
20504         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20505         *ret_conv = CResult__u832APIErrorZ_ok(o_ref);
20506         return tag_ptr(ret_conv, true);
20507 }
20508
20509 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_err"))) TS_CResult__u832APIErrorZ_err(uint64_t e) {
20510         void* e_ptr = untag_ptr(e);
20511         CHECK_ACCESS(e_ptr);
20512         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
20513         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
20514         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20515         *ret_conv = CResult__u832APIErrorZ_err(e_conv);
20516         return tag_ptr(ret_conv, true);
20517 }
20518
20519 jboolean  __attribute__((export_name("TS_CResult__u832APIErrorZ_is_ok"))) TS_CResult__u832APIErrorZ_is_ok(uint64_t o) {
20520         LDKCResult__u832APIErrorZ* o_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(o);
20521         jboolean ret_conv = CResult__u832APIErrorZ_is_ok(o_conv);
20522         return ret_conv;
20523 }
20524
20525 void  __attribute__((export_name("TS_CResult__u832APIErrorZ_free"))) TS_CResult__u832APIErrorZ_free(uint64_t _res) {
20526         if (!ptr_is_owned(_res)) return;
20527         void* _res_ptr = untag_ptr(_res);
20528         CHECK_ACCESS(_res_ptr);
20529         LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(_res_ptr);
20530         FREE(untag_ptr(_res));
20531         CResult__u832APIErrorZ_free(_res_conv);
20532 }
20533
20534 static inline uint64_t CResult__u832APIErrorZ_clone_ptr(LDKCResult__u832APIErrorZ *NONNULL_PTR arg) {
20535         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20536         *ret_conv = CResult__u832APIErrorZ_clone(arg);
20537         return tag_ptr(ret_conv, true);
20538 }
20539 int64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone_ptr"))) TS_CResult__u832APIErrorZ_clone_ptr(uint64_t arg) {
20540         LDKCResult__u832APIErrorZ* arg_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(arg);
20541         int64_t ret_conv = CResult__u832APIErrorZ_clone_ptr(arg_conv);
20542         return ret_conv;
20543 }
20544
20545 uint64_t  __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CResult__u832APIErrorZ_clone(uint64_t orig) {
20546         LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)untag_ptr(orig);
20547         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
20548         *ret_conv = CResult__u832APIErrorZ_clone(orig_conv);
20549         return tag_ptr(ret_conv, true);
20550 }
20551
20552 void  __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) {
20553         LDKCVec_RecentPaymentDetailsZ _res_constr;
20554         _res_constr.datalen = _res->arr_len;
20555         if (_res_constr.datalen > 0)
20556                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
20557         else
20558                 _res_constr.data = NULL;
20559         uint64_t* _res_vals = _res->elems;
20560         for (size_t w = 0; w < _res_constr.datalen; w++) {
20561                 uint64_t _res_conv_22 = _res_vals[w];
20562                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
20563                 CHECK_ACCESS(_res_conv_22_ptr);
20564                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
20565                 FREE(untag_ptr(_res_conv_22));
20566                 _res_constr.data[w] = _res_conv_22_conv;
20567         }
20568         FREE(_res);
20569         CVec_RecentPaymentDetailsZ_free(_res_constr);
20570 }
20571
20572 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() {
20573         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20574         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
20575         return tag_ptr(ret_conv, true);
20576 }
20577
20578 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) {
20579         void* e_ptr = untag_ptr(e);
20580         CHECK_ACCESS(e_ptr);
20581         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20582         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20583         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20584         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
20585         return tag_ptr(ret_conv, true);
20586 }
20587
20588 jboolean  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) {
20589         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
20590         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
20591         return ret_conv;
20592 }
20593
20594 void  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) {
20595         if (!ptr_is_owned(_res)) return;
20596         void* _res_ptr = untag_ptr(_res);
20597         CHECK_ACCESS(_res_ptr);
20598         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
20599         FREE(untag_ptr(_res));
20600         CResult_NonePaymentSendFailureZ_free(_res_conv);
20601 }
20602
20603 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
20604         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20605         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
20606         return tag_ptr(ret_conv, true);
20607 }
20608 int64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) {
20609         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
20610         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
20611         return ret_conv;
20612 }
20613
20614 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) {
20615         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
20616         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
20617         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
20618         return tag_ptr(ret_conv, true);
20619 }
20620
20621 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() {
20622         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20623         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
20624         return tag_ptr(ret_conv, true);
20625 }
20626
20627 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) {
20628         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20629         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20630         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
20631         return tag_ptr(ret_conv, true);
20632 }
20633
20634 jboolean  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) {
20635         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
20636         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
20637         return ret_conv;
20638 }
20639
20640 void  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) {
20641         if (!ptr_is_owned(_res)) return;
20642         void* _res_ptr = untag_ptr(_res);
20643         CHECK_ACCESS(_res_ptr);
20644         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
20645         FREE(untag_ptr(_res));
20646         CResult_NoneRetryableSendFailureZ_free(_res_conv);
20647 }
20648
20649 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
20650         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20651         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
20652         return tag_ptr(ret_conv, true);
20653 }
20654 int64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20655         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
20656         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
20657         return ret_conv;
20658 }
20659
20660 uint64_t  __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) {
20661         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
20662         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
20663         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
20664         return tag_ptr(ret_conv, true);
20665 }
20666
20667 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
20668         LDKThirtyTwoBytes o_ref;
20669         CHECK(o->arr_len == 32);
20670         memcpy(o_ref.data, o->elems, 32); FREE(o);
20671         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20672         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
20673         return tag_ptr(ret_conv, true);
20674 }
20675
20676 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) {
20677         void* e_ptr = untag_ptr(e);
20678         CHECK_ACCESS(e_ptr);
20679         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20680         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20681         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20682         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
20683         return tag_ptr(ret_conv, true);
20684 }
20685
20686 jboolean  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) {
20687         LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o);
20688         jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv);
20689         return ret_conv;
20690 }
20691
20692 void  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) {
20693         if (!ptr_is_owned(_res)) return;
20694         void* _res_ptr = untag_ptr(_res);
20695         CHECK_ACCESS(_res_ptr);
20696         LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr);
20697         FREE(untag_ptr(_res));
20698         CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
20699 }
20700
20701 static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) {
20702         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20703         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg);
20704         return tag_ptr(ret_conv, true);
20705 }
20706 int64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20707         LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg);
20708         int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv);
20709         return ret_conv;
20710 }
20711
20712 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) {
20713         LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig);
20714         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
20715         *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
20716         return tag_ptr(ret_conv, true);
20717 }
20718
20719 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_ok(int8_tArray o) {
20720         LDKThirtyTwoBytes o_ref;
20721         CHECK(o->arr_len == 32);
20722         memcpy(o_ref.data, o->elems, 32); FREE(o);
20723         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
20724         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref);
20725         return tag_ptr(ret_conv, true);
20726 }
20727
20728 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_err(uint32_t e) {
20729         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e);
20730         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
20731         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv);
20732         return tag_ptr(ret_conv, true);
20733 }
20734
20735 jboolean  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_is_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_is_ok(uint64_t o) {
20736         LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o);
20737         jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv);
20738         return ret_conv;
20739 }
20740
20741 void  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_free"))) TS_CResult_PaymentHashRetryableSendFailureZ_free(uint64_t _res) {
20742         if (!ptr_is_owned(_res)) return;
20743         void* _res_ptr = untag_ptr(_res);
20744         CHECK_ACCESS(_res_ptr);
20745         LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr);
20746         FREE(untag_ptr(_res));
20747         CResult_PaymentHashRetryableSendFailureZ_free(_res_conv);
20748 }
20749
20750 static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) {
20751         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
20752         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg);
20753         return tag_ptr(ret_conv, true);
20754 }
20755 int64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr(uint64_t arg) {
20756         LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg);
20757         int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv);
20758         return ret_conv;
20759 }
20760
20761 uint64_t  __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone(uint64_t orig) {
20762         LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig);
20763         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
20764         *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv);
20765         return tag_ptr(ret_conv, true);
20766 }
20767
20768 static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) {
20769         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
20770         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg);
20771         return tag_ptr(ret_conv, true);
20772 }
20773 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone_ptr(uint64_t arg) {
20774         LDKC2Tuple_PaymentHashPaymentIdZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(arg);
20775         int64_t ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone_ptr(arg_conv);
20776         return ret_conv;
20777 }
20778
20779 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_clone"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint64_t orig) {
20780         LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(orig);
20781         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
20782         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv);
20783         return tag_ptr(ret_conv, true);
20784 }
20785
20786 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_new"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, int8_tArray b) {
20787         LDKThirtyTwoBytes a_ref;
20788         CHECK(a->arr_len == 32);
20789         memcpy(a_ref.data, a->elems, 32); FREE(a);
20790         LDKThirtyTwoBytes b_ref;
20791         CHECK(b->arr_len == 32);
20792         memcpy(b_ref.data, b->elems, 32); FREE(b);
20793         LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ");
20794         *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_ref);
20795         return tag_ptr(ret_conv, true);
20796 }
20797
20798 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentIdZ_free"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint64_t _res) {
20799         if (!ptr_is_owned(_res)) return;
20800         void* _res_ptr = untag_ptr(_res);
20801         CHECK_ACCESS(_res_ptr);
20802         LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(_res_ptr);
20803         FREE(untag_ptr(_res));
20804         C2Tuple_PaymentHashPaymentIdZ_free(_res_conv);
20805 }
20806
20807 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint64_t o) {
20808         void* o_ptr = untag_ptr(o);
20809         CHECK_ACCESS(o_ptr);
20810         LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(o_ptr);
20811         o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)untag_ptr(o));
20812         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20813         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv);
20814         return tag_ptr(ret_conv, true);
20815 }
20816
20817 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint64_t e) {
20818         void* e_ptr = untag_ptr(e);
20819         CHECK_ACCESS(e_ptr);
20820         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
20821         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
20822         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20823         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv);
20824         return tag_ptr(ret_conv, true);
20825 }
20826
20827 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(uint64_t o) {
20828         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(o);
20829         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(o_conv);
20830         return ret_conv;
20831 }
20832
20833 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint64_t _res) {
20834         if (!ptr_is_owned(_res)) return;
20835         void* _res_ptr = untag_ptr(_res);
20836         CHECK_ACCESS(_res_ptr);
20837         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(_res_ptr);
20838         FREE(untag_ptr(_res));
20839         CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv);
20840 }
20841
20842 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR arg) {
20843         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20844         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(arg);
20845         return tag_ptr(ret_conv, true);
20846 }
20847 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(uint64_t arg) {
20848         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(arg);
20849         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(arg_conv);
20850         return ret_conv;
20851 }
20852
20853 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint64_t orig) {
20854         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)untag_ptr(orig);
20855         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
20856         *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv);
20857         return tag_ptr(ret_conv, true);
20858 }
20859
20860 void  __attribute__((export_name("TS_CVec_ThirtyTwoBytesZ_free"))) TS_CVec_ThirtyTwoBytesZ_free(ptrArray _res) {
20861         LDKCVec_ThirtyTwoBytesZ _res_constr;
20862         _res_constr.datalen = _res->arr_len;
20863         if (_res_constr.datalen > 0)
20864                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
20865         else
20866                 _res_constr.data = NULL;
20867         int8_tArray* _res_vals = (void*) _res->elems;
20868         for (size_t m = 0; m < _res_constr.datalen; m++) {
20869                 int8_tArray _res_conv_12 = _res_vals[m];
20870                 LDKThirtyTwoBytes _res_conv_12_ref;
20871                 CHECK(_res_conv_12->arr_len == 32);
20872                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12);
20873                 _res_constr.data[m] = _res_conv_12_ref;
20874         }
20875         FREE(_res);
20876         CVec_ThirtyTwoBytesZ_free(_res_constr);
20877 }
20878
20879 static inline uint64_t C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR arg) {
20880         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20881         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(arg);
20882         return tag_ptr(ret_conv, true);
20883 }
20884 int64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(uint64_t arg) {
20885         LDKC2Tuple_PaymentHashPaymentSecretZ* arg_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(arg);
20886         int64_t ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(arg_conv);
20887         return ret_conv;
20888 }
20889
20890 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_clone"))) TS_C2Tuple_PaymentHashPaymentSecretZ_clone(uint64_t orig) {
20891         LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(orig);
20892         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20893         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
20894         return tag_ptr(ret_conv, true);
20895 }
20896
20897 uint64_t  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_new"))) TS_C2Tuple_PaymentHashPaymentSecretZ_new(int8_tArray a, int8_tArray b) {
20898         LDKThirtyTwoBytes a_ref;
20899         CHECK(a->arr_len == 32);
20900         memcpy(a_ref.data, a->elems, 32); FREE(a);
20901         LDKThirtyTwoBytes b_ref;
20902         CHECK(b->arr_len == 32);
20903         memcpy(b_ref.data, b->elems, 32); FREE(b);
20904         LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
20905         *ret_conv = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
20906         return tag_ptr(ret_conv, true);
20907 }
20908
20909 void  __attribute__((export_name("TS_C2Tuple_PaymentHashPaymentSecretZ_free"))) TS_C2Tuple_PaymentHashPaymentSecretZ_free(uint64_t _res) {
20910         if (!ptr_is_owned(_res)) return;
20911         void* _res_ptr = untag_ptr(_res);
20912         CHECK_ACCESS(_res_ptr);
20913         LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(_res_ptr);
20914         FREE(untag_ptr(_res));
20915         C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
20916 }
20917
20918 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint64_t o) {
20919         void* o_ptr = untag_ptr(o);
20920         CHECK_ACCESS(o_ptr);
20921         LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr);
20922         o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)untag_ptr(o));
20923         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20924         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv);
20925         return tag_ptr(ret_conv, true);
20926 }
20927
20928 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() {
20929         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20930         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err();
20931         return tag_ptr(ret_conv, true);
20932 }
20933
20934 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint64_t o) {
20935         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(o);
20936         jboolean ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv);
20937         return ret_conv;
20938 }
20939
20940 void  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint64_t _res) {
20941         if (!ptr_is_owned(_res)) return;
20942         void* _res_ptr = untag_ptr(_res);
20943         CHECK_ACCESS(_res_ptr);
20944         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr);
20945         FREE(untag_ptr(_res));
20946         CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv);
20947 }
20948
20949 static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) {
20950         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20951         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg);
20952         return tag_ptr(ret_conv, true);
20953 }
20954 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint64_t arg) {
20955         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(arg);
20956         int64_t ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv);
20957         return ret_conv;
20958 }
20959
20960 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint64_t orig) {
20961         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)untag_ptr(orig);
20962         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
20963         *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv);
20964         return tag_ptr(ret_conv, true);
20965 }
20966
20967 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_ok"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) {
20968         LDKThirtyTwoBytes o_ref;
20969         CHECK(o->arr_len == 32);
20970         memcpy(o_ref.data, o->elems, 32); FREE(o);
20971         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20972         *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref);
20973         return tag_ptr(ret_conv, true);
20974 }
20975
20976 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_err"))) TS_CResult_PaymentSecretNoneZ_err() {
20977         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20978         *ret_conv = CResult_PaymentSecretNoneZ_err();
20979         return tag_ptr(ret_conv, true);
20980 }
20981
20982 jboolean  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_is_ok"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint64_t o) {
20983         LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(o);
20984         jboolean ret_conv = CResult_PaymentSecretNoneZ_is_ok(o_conv);
20985         return ret_conv;
20986 }
20987
20988 void  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_free"))) TS_CResult_PaymentSecretNoneZ_free(uint64_t _res) {
20989         if (!ptr_is_owned(_res)) return;
20990         void* _res_ptr = untag_ptr(_res);
20991         CHECK_ACCESS(_res_ptr);
20992         LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr);
20993         FREE(untag_ptr(_res));
20994         CResult_PaymentSecretNoneZ_free(_res_conv);
20995 }
20996
20997 static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) {
20998         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
20999         *ret_conv = CResult_PaymentSecretNoneZ_clone(arg);
21000         return tag_ptr(ret_conv, true);
21001 }
21002 int64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone_ptr"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint64_t arg) {
21003         LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(arg);
21004         int64_t ret_conv = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv);
21005         return ret_conv;
21006 }
21007
21008 uint64_t  __attribute__((export_name("TS_CResult_PaymentSecretNoneZ_clone"))) TS_CResult_PaymentSecretNoneZ_clone(uint64_t orig) {
21009         LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)untag_ptr(orig);
21010         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
21011         *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv);
21012         return tag_ptr(ret_conv, true);
21013 }
21014
21015 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) {
21016         LDKThirtyTwoBytes o_ref;
21017         CHECK(o->arr_len == 32);
21018         memcpy(o_ref.data, o->elems, 32); FREE(o);
21019         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21020         *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref);
21021         return tag_ptr(ret_conv, true);
21022 }
21023
21024 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_err"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint64_t e) {
21025         void* e_ptr = untag_ptr(e);
21026         CHECK_ACCESS(e_ptr);
21027         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
21028         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
21029         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21030         *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv);
21031         return tag_ptr(ret_conv, true);
21032 }
21033
21034 jboolean  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_is_ok"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint64_t o) {
21035         LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(o);
21036         jboolean ret_conv = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv);
21037         return ret_conv;
21038 }
21039
21040 void  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_free"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint64_t _res) {
21041         if (!ptr_is_owned(_res)) return;
21042         void* _res_ptr = untag_ptr(_res);
21043         CHECK_ACCESS(_res_ptr);
21044         LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr);
21045         FREE(untag_ptr(_res));
21046         CResult_PaymentPreimageAPIErrorZ_free(_res_conv);
21047 }
21048
21049 static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) {
21050         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21051         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg);
21052         return tag_ptr(ret_conv, true);
21053 }
21054 int64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint64_t arg) {
21055         LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(arg);
21056         int64_t ret_conv = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv);
21057         return ret_conv;
21058 }
21059
21060 uint64_t  __attribute__((export_name("TS_CResult_PaymentPreimageAPIErrorZ_clone"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint64_t orig) {
21061         LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)untag_ptr(orig);
21062         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
21063         *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv);
21064         return tag_ptr(ret_conv, true);
21065 }
21066
21067 uint64_t  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_some"))) TS_COption_CVec_ChainHashZZ_some(ptrArray o) {
21068         LDKCVec_ChainHashZ o_constr;
21069         o_constr.datalen = o->arr_len;
21070         if (o_constr.datalen > 0)
21071                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ChainHashZ Elements");
21072         else
21073                 o_constr.data = NULL;
21074         int8_tArray* o_vals = (void*) o->elems;
21075         for (size_t m = 0; m < o_constr.datalen; m++) {
21076                 int8_tArray o_conv_12 = o_vals[m];
21077                 LDKThirtyTwoBytes o_conv_12_ref;
21078                 CHECK(o_conv_12->arr_len == 32);
21079                 memcpy(o_conv_12_ref.data, o_conv_12->elems, 32); FREE(o_conv_12);
21080                 o_constr.data[m] = o_conv_12_ref;
21081         }
21082         FREE(o);
21083         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
21084         *ret_copy = COption_CVec_ChainHashZZ_some(o_constr);
21085         uint64_t ret_ref = tag_ptr(ret_copy, true);
21086         return ret_ref;
21087 }
21088
21089 uint64_t  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_none"))) TS_COption_CVec_ChainHashZZ_none() {
21090         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
21091         *ret_copy = COption_CVec_ChainHashZZ_none();
21092         uint64_t ret_ref = tag_ptr(ret_copy, true);
21093         return ret_ref;
21094 }
21095
21096 void  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_free"))) TS_COption_CVec_ChainHashZZ_free(uint64_t _res) {
21097         if (!ptr_is_owned(_res)) return;
21098         void* _res_ptr = untag_ptr(_res);
21099         CHECK_ACCESS(_res_ptr);
21100         LDKCOption_CVec_ChainHashZZ _res_conv = *(LDKCOption_CVec_ChainHashZZ*)(_res_ptr);
21101         FREE(untag_ptr(_res));
21102         COption_CVec_ChainHashZZ_free(_res_conv);
21103 }
21104
21105 static inline uint64_t COption_CVec_ChainHashZZ_clone_ptr(LDKCOption_CVec_ChainHashZZ *NONNULL_PTR arg) {
21106         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
21107         *ret_copy = COption_CVec_ChainHashZZ_clone(arg);
21108         uint64_t ret_ref = tag_ptr(ret_copy, true);
21109         return ret_ref;
21110 }
21111 int64_t  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_clone_ptr"))) TS_COption_CVec_ChainHashZZ_clone_ptr(uint64_t arg) {
21112         LDKCOption_CVec_ChainHashZZ* arg_conv = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(arg);
21113         int64_t ret_conv = COption_CVec_ChainHashZZ_clone_ptr(arg_conv);
21114         return ret_conv;
21115 }
21116
21117 uint64_t  __attribute__((export_name("TS_COption_CVec_ChainHashZZ_clone"))) TS_COption_CVec_ChainHashZZ_clone(uint64_t orig) {
21118         LDKCOption_CVec_ChainHashZZ* orig_conv = (LDKCOption_CVec_ChainHashZZ*)untag_ptr(orig);
21119         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
21120         *ret_copy = COption_CVec_ChainHashZZ_clone(orig_conv);
21121         uint64_t ret_ref = tag_ptr(ret_copy, true);
21122         return ret_ref;
21123 }
21124
21125 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(uint64_t o) {
21126         LDKCounterpartyForwardingInfo o_conv;
21127         o_conv.inner = untag_ptr(o);
21128         o_conv.is_owned = ptr_is_owned(o);
21129         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21130         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
21131         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21132         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
21133         return tag_ptr(ret_conv, true);
21134 }
21135
21136 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_err(uint64_t e) {
21137         void* e_ptr = untag_ptr(e);
21138         CHECK_ACCESS(e_ptr);
21139         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21140         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21141         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21142         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
21143         return tag_ptr(ret_conv, true);
21144 }
21145
21146 jboolean  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(uint64_t o) {
21147         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
21148         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
21149         return ret_conv;
21150 }
21151
21152 void  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_free(uint64_t _res) {
21153         if (!ptr_is_owned(_res)) return;
21154         void* _res_ptr = untag_ptr(_res);
21155         CHECK_ACCESS(_res_ptr);
21156         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
21157         FREE(untag_ptr(_res));
21158         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
21159 }
21160
21161 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
21162         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21163         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
21164         return tag_ptr(ret_conv, true);
21165 }
21166 int64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(uint64_t arg) {
21167         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
21168         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
21169         return ret_conv;
21170 }
21171
21172 uint64_t  __attribute__((export_name("TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone"))) TS_CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(uint64_t orig) {
21173         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
21174         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
21175         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
21176         return tag_ptr(ret_conv, true);
21177 }
21178
21179 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_ok(uint64_t o) {
21180         LDKChannelCounterparty o_conv;
21181         o_conv.inner = untag_ptr(o);
21182         o_conv.is_owned = ptr_is_owned(o);
21183         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21184         o_conv = ChannelCounterparty_clone(&o_conv);
21185         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21186         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
21187         return tag_ptr(ret_conv, true);
21188 }
21189
21190 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_err"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_err(uint64_t e) {
21191         void* e_ptr = untag_ptr(e);
21192         CHECK_ACCESS(e_ptr);
21193         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21194         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21195         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21196         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
21197         return tag_ptr(ret_conv, true);
21198 }
21199
21200 jboolean  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_is_ok(uint64_t o) {
21201         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
21202         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
21203         return ret_conv;
21204 }
21205
21206 void  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_free"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_free(uint64_t _res) {
21207         if (!ptr_is_owned(_res)) return;
21208         void* _res_ptr = untag_ptr(_res);
21209         CHECK_ACCESS(_res_ptr);
21210         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
21211         FREE(untag_ptr(_res));
21212         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
21213 }
21214
21215 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
21216         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21217         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
21218         return tag_ptr(ret_conv, true);
21219 }
21220 int64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(uint64_t arg) {
21221         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
21222         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
21223         return ret_conv;
21224 }
21225
21226 uint64_t  __attribute__((export_name("TS_CResult_ChannelCounterpartyDecodeErrorZ_clone"))) TS_CResult_ChannelCounterpartyDecodeErrorZ_clone(uint64_t orig) {
21227         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
21228         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
21229         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
21230         return tag_ptr(ret_conv, true);
21231 }
21232
21233 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_ok(uint64_t o) {
21234         LDKChannelDetails o_conv;
21235         o_conv.inner = untag_ptr(o);
21236         o_conv.is_owned = ptr_is_owned(o);
21237         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21238         o_conv = ChannelDetails_clone(&o_conv);
21239         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21240         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
21241         return tag_ptr(ret_conv, true);
21242 }
21243
21244 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_err"))) TS_CResult_ChannelDetailsDecodeErrorZ_err(uint64_t e) {
21245         void* e_ptr = untag_ptr(e);
21246         CHECK_ACCESS(e_ptr);
21247         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21248         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21249         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21250         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
21251         return tag_ptr(ret_conv, true);
21252 }
21253
21254 jboolean  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_is_ok"))) TS_CResult_ChannelDetailsDecodeErrorZ_is_ok(uint64_t o) {
21255         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
21256         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
21257         return ret_conv;
21258 }
21259
21260 void  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_free"))) TS_CResult_ChannelDetailsDecodeErrorZ_free(uint64_t _res) {
21261         if (!ptr_is_owned(_res)) return;
21262         void* _res_ptr = untag_ptr(_res);
21263         CHECK_ACCESS(_res_ptr);
21264         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
21265         FREE(untag_ptr(_res));
21266         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
21267 }
21268
21269 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
21270         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21271         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
21272         return tag_ptr(ret_conv, true);
21273 }
21274 int64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone_ptr(uint64_t arg) {
21275         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
21276         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
21277         return ret_conv;
21278 }
21279
21280 uint64_t  __attribute__((export_name("TS_CResult_ChannelDetailsDecodeErrorZ_clone"))) TS_CResult_ChannelDetailsDecodeErrorZ_clone(uint64_t orig) {
21281         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
21282         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
21283         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
21284         return tag_ptr(ret_conv, true);
21285 }
21286
21287 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_ok(uint64_t o) {
21288         LDKPhantomRouteHints o_conv;
21289         o_conv.inner = untag_ptr(o);
21290         o_conv.is_owned = ptr_is_owned(o);
21291         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21292         o_conv = PhantomRouteHints_clone(&o_conv);
21293         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21294         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
21295         return tag_ptr(ret_conv, true);
21296 }
21297
21298 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_err"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_err(uint64_t e) {
21299         void* e_ptr = untag_ptr(e);
21300         CHECK_ACCESS(e_ptr);
21301         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21302         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21303         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21304         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
21305         return tag_ptr(ret_conv, true);
21306 }
21307
21308 jboolean  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_is_ok(uint64_t o) {
21309         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
21310         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
21311         return ret_conv;
21312 }
21313
21314 void  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_free"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_free(uint64_t _res) {
21315         if (!ptr_is_owned(_res)) return;
21316         void* _res_ptr = untag_ptr(_res);
21317         CHECK_ACCESS(_res_ptr);
21318         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
21319         FREE(untag_ptr(_res));
21320         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
21321 }
21322
21323 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
21324         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21325         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
21326         return tag_ptr(ret_conv, true);
21327 }
21328 int64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(uint64_t arg) {
21329         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
21330         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
21331         return ret_conv;
21332 }
21333
21334 uint64_t  __attribute__((export_name("TS_CResult_PhantomRouteHintsDecodeErrorZ_clone"))) TS_CResult_PhantomRouteHintsDecodeErrorZ_clone(uint64_t orig) {
21335         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
21336         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
21337         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
21338         return tag_ptr(ret_conv, true);
21339 }
21340
21341 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_ok(uint32_t o) {
21342         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_js(o);
21343         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21344         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
21345         return tag_ptr(ret_conv, true);
21346 }
21347
21348 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_err"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_err(uint64_t e) {
21349         void* e_ptr = untag_ptr(e);
21350         CHECK_ACCESS(e_ptr);
21351         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21352         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21353         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21354         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
21355         return tag_ptr(ret_conv, true);
21356 }
21357
21358 jboolean  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_is_ok(uint64_t o) {
21359         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
21360         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
21361         return ret_conv;
21362 }
21363
21364 void  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_free"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_free(uint64_t _res) {
21365         if (!ptr_is_owned(_res)) return;
21366         void* _res_ptr = untag_ptr(_res);
21367         CHECK_ACCESS(_res_ptr);
21368         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
21369         FREE(untag_ptr(_res));
21370         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
21371 }
21372
21373 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
21374         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21375         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
21376         return tag_ptr(ret_conv, true);
21377 }
21378 int64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(uint64_t arg) {
21379         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
21380         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
21381         return ret_conv;
21382 }
21383
21384 uint64_t  __attribute__((export_name("TS_CResult_ChannelShutdownStateDecodeErrorZ_clone"))) TS_CResult_ChannelShutdownStateDecodeErrorZ_clone(uint64_t orig) {
21385         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
21386         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
21387         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
21388         return tag_ptr(ret_conv, true);
21389 }
21390
21391 void  __attribute__((export_name("TS_CVec_ChannelMonitorZ_free"))) TS_CVec_ChannelMonitorZ_free(uint64_tArray _res) {
21392         LDKCVec_ChannelMonitorZ _res_constr;
21393         _res_constr.datalen = _res->arr_len;
21394         if (_res_constr.datalen > 0)
21395                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
21396         else
21397                 _res_constr.data = NULL;
21398         uint64_t* _res_vals = _res->elems;
21399         for (size_t q = 0; q < _res_constr.datalen; q++) {
21400                 uint64_t _res_conv_16 = _res_vals[q];
21401                 LDKChannelMonitor _res_conv_16_conv;
21402                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
21403                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
21404                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
21405                 _res_constr.data[q] = _res_conv_16_conv;
21406         }
21407         FREE(_res);
21408         CVec_ChannelMonitorZ_free(_res_constr);
21409 }
21410
21411 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_new"))) TS_C2Tuple_BlockHashChannelManagerZ_new(int8_tArray a, uint64_t b) {
21412         LDKThirtyTwoBytes a_ref;
21413         CHECK(a->arr_len == 32);
21414         memcpy(a_ref.data, a->elems, 32); FREE(a);
21415         LDKChannelManager b_conv;
21416         b_conv.inner = untag_ptr(b);
21417         b_conv.is_owned = ptr_is_owned(b);
21418         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
21419         // WARNING: we need a move here but no clone is available for LDKChannelManager
21420         
21421         LDKC2Tuple_BlockHashChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
21422         *ret_conv = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
21423         return tag_ptr(ret_conv, true);
21424 }
21425
21426 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_free"))) TS_C2Tuple_BlockHashChannelManagerZ_free(uint64_t _res) {
21427         if (!ptr_is_owned(_res)) return;
21428         void* _res_ptr = untag_ptr(_res);
21429         CHECK_ACCESS(_res_ptr);
21430         LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(_res_ptr);
21431         FREE(untag_ptr(_res));
21432         C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
21433 }
21434
21435 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint64_t o) {
21436         void* o_ptr = untag_ptr(o);
21437         CHECK_ACCESS(o_ptr);
21438         LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(o_ptr);
21439         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
21440         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
21441         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
21442         return tag_ptr(ret_conv, true);
21443 }
21444
21445 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(uint64_t e) {
21446         void* e_ptr = untag_ptr(e);
21447         CHECK_ACCESS(e_ptr);
21448         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21449         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21450         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
21451         *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
21452         return tag_ptr(ret_conv, true);
21453 }
21454
21455 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(uint64_t o) {
21456         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)untag_ptr(o);
21457         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(o_conv);
21458         return ret_conv;
21459 }
21460
21461 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(uint64_t _res) {
21462         if (!ptr_is_owned(_res)) return;
21463         void* _res_ptr = untag_ptr(_res);
21464         CHECK_ACCESS(_res_ptr);
21465         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(_res_ptr);
21466         FREE(untag_ptr(_res));
21467         CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
21468 }
21469
21470 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_ok(uint64_t o) {
21471         void* o_ptr = untag_ptr(o);
21472         CHECK_ACCESS(o_ptr);
21473         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21474         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21475         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21476         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
21477         return tag_ptr(ret_conv, true);
21478 }
21479
21480 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_err(uint64_t e) {
21481         void* e_ptr = untag_ptr(e);
21482         CHECK_ACCESS(e_ptr);
21483         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21484         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21485         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21486         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
21487         return tag_ptr(ret_conv, true);
21488 }
21489
21490 jboolean  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(uint64_t o) {
21491         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
21492         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
21493         return ret_conv;
21494 }
21495
21496 void  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_free(uint64_t _res) {
21497         if (!ptr_is_owned(_res)) return;
21498         void* _res_ptr = untag_ptr(_res);
21499         CHECK_ACCESS(_res_ptr);
21500         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
21501         FREE(untag_ptr(_res));
21502         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
21503 }
21504
21505 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
21506         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21507         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
21508         return tag_ptr(ret_conv, true);
21509 }
21510 int64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(uint64_t arg) {
21511         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
21512         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
21513         return ret_conv;
21514 }
21515
21516 uint64_t  __attribute__((export_name("TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone"))) TS_CResult_MaxDustHTLCExposureDecodeErrorZ_clone(uint64_t orig) {
21517         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
21518         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
21519         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
21520         return tag_ptr(ret_conv, true);
21521 }
21522
21523 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_ok(uint64_t o) {
21524         LDKChannelConfig o_conv;
21525         o_conv.inner = untag_ptr(o);
21526         o_conv.is_owned = ptr_is_owned(o);
21527         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21528         o_conv = ChannelConfig_clone(&o_conv);
21529         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21530         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
21531         return tag_ptr(ret_conv, true);
21532 }
21533
21534 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_err"))) TS_CResult_ChannelConfigDecodeErrorZ_err(uint64_t e) {
21535         void* e_ptr = untag_ptr(e);
21536         CHECK_ACCESS(e_ptr);
21537         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21538         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21539         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21540         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
21541         return tag_ptr(ret_conv, true);
21542 }
21543
21544 jboolean  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_is_ok"))) TS_CResult_ChannelConfigDecodeErrorZ_is_ok(uint64_t o) {
21545         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
21546         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
21547         return ret_conv;
21548 }
21549
21550 void  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_free"))) TS_CResult_ChannelConfigDecodeErrorZ_free(uint64_t _res) {
21551         if (!ptr_is_owned(_res)) return;
21552         void* _res_ptr = untag_ptr(_res);
21553         CHECK_ACCESS(_res_ptr);
21554         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
21555         FREE(untag_ptr(_res));
21556         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
21557 }
21558
21559 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
21560         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21561         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
21562         return tag_ptr(ret_conv, true);
21563 }
21564 int64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelConfigDecodeErrorZ_clone_ptr(uint64_t arg) {
21565         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
21566         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
21567         return ret_conv;
21568 }
21569
21570 uint64_t  __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone"))) TS_CResult_ChannelConfigDecodeErrorZ_clone(uint64_t orig) {
21571         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
21572         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
21573         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
21574         return tag_ptr(ret_conv, true);
21575 }
21576
21577 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_some"))) TS_COption_MaxDustHTLCExposureZ_some(uint64_t o) {
21578         void* o_ptr = untag_ptr(o);
21579         CHECK_ACCESS(o_ptr);
21580         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
21581         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
21582         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21583         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
21584         uint64_t ret_ref = tag_ptr(ret_copy, true);
21585         return ret_ref;
21586 }
21587
21588 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_none"))) TS_COption_MaxDustHTLCExposureZ_none() {
21589         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21590         *ret_copy = COption_MaxDustHTLCExposureZ_none();
21591         uint64_t ret_ref = tag_ptr(ret_copy, true);
21592         return ret_ref;
21593 }
21594
21595 void  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_free"))) TS_COption_MaxDustHTLCExposureZ_free(uint64_t _res) {
21596         if (!ptr_is_owned(_res)) return;
21597         void* _res_ptr = untag_ptr(_res);
21598         CHECK_ACCESS(_res_ptr);
21599         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
21600         FREE(untag_ptr(_res));
21601         COption_MaxDustHTLCExposureZ_free(_res_conv);
21602 }
21603
21604 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
21605         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21606         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
21607         uint64_t ret_ref = tag_ptr(ret_copy, true);
21608         return ret_ref;
21609 }
21610 int64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone_ptr"))) TS_COption_MaxDustHTLCExposureZ_clone_ptr(uint64_t arg) {
21611         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
21612         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
21613         return ret_conv;
21614 }
21615
21616 uint64_t  __attribute__((export_name("TS_COption_MaxDustHTLCExposureZ_clone"))) TS_COption_MaxDustHTLCExposureZ_clone(uint64_t orig) {
21617         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
21618         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
21619         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
21620         uint64_t ret_ref = tag_ptr(ret_copy, true);
21621         return ret_ref;
21622 }
21623
21624 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) {
21625         void* o_ptr = untag_ptr(o);
21626         CHECK_ACCESS(o_ptr);
21627         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
21628         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
21629         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21630         *ret_copy = COption_APIErrorZ_some(o_conv);
21631         uint64_t ret_ref = tag_ptr(ret_copy, true);
21632         return ret_ref;
21633 }
21634
21635 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() {
21636         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21637         *ret_copy = COption_APIErrorZ_none();
21638         uint64_t ret_ref = tag_ptr(ret_copy, true);
21639         return ret_ref;
21640 }
21641
21642 void  __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) {
21643         if (!ptr_is_owned(_res)) return;
21644         void* _res_ptr = untag_ptr(_res);
21645         CHECK_ACCESS(_res_ptr);
21646         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
21647         FREE(untag_ptr(_res));
21648         COption_APIErrorZ_free(_res_conv);
21649 }
21650
21651 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
21652         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21653         *ret_copy = COption_APIErrorZ_clone(arg);
21654         uint64_t ret_ref = tag_ptr(ret_copy, true);
21655         return ret_ref;
21656 }
21657 int64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) {
21658         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
21659         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
21660         return ret_conv;
21661 }
21662
21663 uint64_t  __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) {
21664         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
21665         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
21666         *ret_copy = COption_APIErrorZ_clone(orig_conv);
21667         uint64_t ret_ref = tag_ptr(ret_copy, true);
21668         return ret_ref;
21669 }
21670
21671 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) {
21672         void* o_ptr = untag_ptr(o);
21673         CHECK_ACCESS(o_ptr);
21674         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
21675         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
21676         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21677         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
21678         return tag_ptr(ret_conv, true);
21679 }
21680
21681 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_err(uint64_t e) {
21682         void* e_ptr = untag_ptr(e);
21683         CHECK_ACCESS(e_ptr);
21684         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21685         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21686         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21687         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
21688         return tag_ptr(ret_conv, true);
21689 }
21690
21691 jboolean  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) {
21692         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
21693         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
21694         return ret_conv;
21695 }
21696
21697 void  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) {
21698         if (!ptr_is_owned(_res)) return;
21699         void* _res_ptr = untag_ptr(_res);
21700         CHECK_ACCESS(_res_ptr);
21701         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
21702         FREE(untag_ptr(_res));
21703         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
21704 }
21705
21706 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
21707         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21708         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
21709         return tag_ptr(ret_conv, true);
21710 }
21711 int64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) {
21712         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
21713         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
21714         return ret_conv;
21715 }
21716
21717 uint64_t  __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) {
21718         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
21719         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
21720         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
21721         return tag_ptr(ret_conv, true);
21722 }
21723
21724 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_ok"))) TS_CResult_BigSizeDecodeErrorZ_ok(uint64_t o) {
21725         LDKBigSize o_conv;
21726         o_conv.inner = untag_ptr(o);
21727         o_conv.is_owned = ptr_is_owned(o);
21728         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21729         o_conv = BigSize_clone(&o_conv);
21730         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
21731         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
21732         return tag_ptr(ret_conv, true);
21733 }
21734
21735 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_err"))) TS_CResult_BigSizeDecodeErrorZ_err(uint64_t e) {
21736         void* e_ptr = untag_ptr(e);
21737         CHECK_ACCESS(e_ptr);
21738         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21739         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21740         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
21741         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
21742         return tag_ptr(ret_conv, true);
21743 }
21744
21745 jboolean  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_is_ok"))) TS_CResult_BigSizeDecodeErrorZ_is_ok(uint64_t o) {
21746         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
21747         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
21748         return ret_conv;
21749 }
21750
21751 void  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_free"))) TS_CResult_BigSizeDecodeErrorZ_free(uint64_t _res) {
21752         if (!ptr_is_owned(_res)) return;
21753         void* _res_ptr = untag_ptr(_res);
21754         CHECK_ACCESS(_res_ptr);
21755         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
21756         FREE(untag_ptr(_res));
21757         CResult_BigSizeDecodeErrorZ_free(_res_conv);
21758 }
21759
21760 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
21761         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
21762         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
21763         return tag_ptr(ret_conv, true);
21764 }
21765 int64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone_ptr"))) TS_CResult_BigSizeDecodeErrorZ_clone_ptr(uint64_t arg) {
21766         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
21767         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
21768         return ret_conv;
21769 }
21770
21771 uint64_t  __attribute__((export_name("TS_CResult_BigSizeDecodeErrorZ_clone"))) TS_CResult_BigSizeDecodeErrorZ_clone(uint64_t orig) {
21772         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
21773         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
21774         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
21775         return tag_ptr(ret_conv, true);
21776 }
21777
21778 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_ok"))) TS_CResult_HostnameDecodeErrorZ_ok(uint64_t o) {
21779         LDKHostname o_conv;
21780         o_conv.inner = untag_ptr(o);
21781         o_conv.is_owned = ptr_is_owned(o);
21782         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21783         o_conv = Hostname_clone(&o_conv);
21784         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
21785         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
21786         return tag_ptr(ret_conv, true);
21787 }
21788
21789 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_err"))) TS_CResult_HostnameDecodeErrorZ_err(uint64_t e) {
21790         void* e_ptr = untag_ptr(e);
21791         CHECK_ACCESS(e_ptr);
21792         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21793         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21794         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
21795         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
21796         return tag_ptr(ret_conv, true);
21797 }
21798
21799 jboolean  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_is_ok"))) TS_CResult_HostnameDecodeErrorZ_is_ok(uint64_t o) {
21800         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
21801         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
21802         return ret_conv;
21803 }
21804
21805 void  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_free"))) TS_CResult_HostnameDecodeErrorZ_free(uint64_t _res) {
21806         if (!ptr_is_owned(_res)) return;
21807         void* _res_ptr = untag_ptr(_res);
21808         CHECK_ACCESS(_res_ptr);
21809         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
21810         FREE(untag_ptr(_res));
21811         CResult_HostnameDecodeErrorZ_free(_res_conv);
21812 }
21813
21814 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
21815         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
21816         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
21817         return tag_ptr(ret_conv, true);
21818 }
21819 int64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone_ptr"))) TS_CResult_HostnameDecodeErrorZ_clone_ptr(uint64_t arg) {
21820         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
21821         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
21822         return ret_conv;
21823 }
21824
21825 uint64_t  __attribute__((export_name("TS_CResult_HostnameDecodeErrorZ_clone"))) TS_CResult_HostnameDecodeErrorZ_clone(uint64_t orig) {
21826         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
21827         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
21828         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
21829         return tag_ptr(ret_conv, true);
21830 }
21831
21832 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_ok(uint64_t o) {
21833         LDKTransactionU16LenLimited o_conv;
21834         o_conv.inner = untag_ptr(o);
21835         o_conv.is_owned = ptr_is_owned(o);
21836         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21837         o_conv = TransactionU16LenLimited_clone(&o_conv);
21838         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
21839         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
21840         return tag_ptr(ret_conv, true);
21841 }
21842
21843 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_err"))) TS_CResult_TransactionU16LenLimitedNoneZ_err() {
21844         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
21845         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
21846         return tag_ptr(ret_conv, true);
21847 }
21848
21849 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_is_ok"))) TS_CResult_TransactionU16LenLimitedNoneZ_is_ok(uint64_t o) {
21850         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
21851         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
21852         return ret_conv;
21853 }
21854
21855 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_free"))) TS_CResult_TransactionU16LenLimitedNoneZ_free(uint64_t _res) {
21856         if (!ptr_is_owned(_res)) return;
21857         void* _res_ptr = untag_ptr(_res);
21858         CHECK_ACCESS(_res_ptr);
21859         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
21860         FREE(untag_ptr(_res));
21861         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
21862 }
21863
21864 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
21865         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
21866         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
21867         return tag_ptr(ret_conv, true);
21868 }
21869 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone_ptr(uint64_t arg) {
21870         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
21871         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
21872         return ret_conv;
21873 }
21874
21875 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedNoneZ_clone"))) TS_CResult_TransactionU16LenLimitedNoneZ_clone(uint64_t orig) {
21876         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
21877         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
21878         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
21879         return tag_ptr(ret_conv, true);
21880 }
21881
21882 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_ok(uint64_t o) {
21883         LDKTransactionU16LenLimited o_conv;
21884         o_conv.inner = untag_ptr(o);
21885         o_conv.is_owned = ptr_is_owned(o);
21886         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21887         o_conv = TransactionU16LenLimited_clone(&o_conv);
21888         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
21889         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
21890         return tag_ptr(ret_conv, true);
21891 }
21892
21893 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_err(uint64_t e) {
21894         void* e_ptr = untag_ptr(e);
21895         CHECK_ACCESS(e_ptr);
21896         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21897         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21898         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
21899         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
21900         return tag_ptr(ret_conv, true);
21901 }
21902
21903 jboolean  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(uint64_t o) {
21904         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
21905         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
21906         return ret_conv;
21907 }
21908
21909 void  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_free(uint64_t _res) {
21910         if (!ptr_is_owned(_res)) return;
21911         void* _res_ptr = untag_ptr(_res);
21912         CHECK_ACCESS(_res_ptr);
21913         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
21914         FREE(untag_ptr(_res));
21915         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
21916 }
21917
21918 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
21919         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
21920         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
21921         return tag_ptr(ret_conv, true);
21922 }
21923 int64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(uint64_t arg) {
21924         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
21925         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
21926         return ret_conv;
21927 }
21928
21929 uint64_t  __attribute__((export_name("TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone"))) TS_CResult_TransactionU16LenLimitedDecodeErrorZ_clone(uint64_t orig) {
21930         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
21931         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
21932         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
21933         return tag_ptr(ret_conv, true);
21934 }
21935
21936 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_ok(uint64_t o) {
21937         LDKUntrustedString o_conv;
21938         o_conv.inner = untag_ptr(o);
21939         o_conv.is_owned = ptr_is_owned(o);
21940         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21941         o_conv = UntrustedString_clone(&o_conv);
21942         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
21943         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
21944         return tag_ptr(ret_conv, true);
21945 }
21946
21947 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_err"))) TS_CResult_UntrustedStringDecodeErrorZ_err(uint64_t e) {
21948         void* e_ptr = untag_ptr(e);
21949         CHECK_ACCESS(e_ptr);
21950         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
21951         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
21952         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
21953         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
21954         return tag_ptr(ret_conv, true);
21955 }
21956
21957 jboolean  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_is_ok"))) TS_CResult_UntrustedStringDecodeErrorZ_is_ok(uint64_t o) {
21958         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
21959         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
21960         return ret_conv;
21961 }
21962
21963 void  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_free"))) TS_CResult_UntrustedStringDecodeErrorZ_free(uint64_t _res) {
21964         if (!ptr_is_owned(_res)) return;
21965         void* _res_ptr = untag_ptr(_res);
21966         CHECK_ACCESS(_res_ptr);
21967         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
21968         FREE(untag_ptr(_res));
21969         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
21970 }
21971
21972 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
21973         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
21974         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
21975         return tag_ptr(ret_conv, true);
21976 }
21977 int64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr"))) TS_CResult_UntrustedStringDecodeErrorZ_clone_ptr(uint64_t arg) {
21978         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
21979         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
21980         return ret_conv;
21981 }
21982
21983 uint64_t  __attribute__((export_name("TS_CResult_UntrustedStringDecodeErrorZ_clone"))) TS_CResult_UntrustedStringDecodeErrorZ_clone(uint64_t orig) {
21984         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
21985         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
21986         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
21987         return tag_ptr(ret_conv, true);
21988 }
21989
21990 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) {
21991         LDKOutPoint o_conv;
21992         o_conv.inner = untag_ptr(o);
21993         o_conv.is_owned = ptr_is_owned(o);
21994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
21995         o_conv = OutPoint_clone(&o_conv);
21996         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
21997         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
21998         return tag_ptr(ret_conv, true);
21999 }
22000
22001 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_err"))) TS_CResult_OutPointDecodeErrorZ_err(uint64_t e) {
22002         void* e_ptr = untag_ptr(e);
22003         CHECK_ACCESS(e_ptr);
22004         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22005         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22006         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
22007         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
22008         return tag_ptr(ret_conv, true);
22009 }
22010
22011 jboolean  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_is_ok"))) TS_CResult_OutPointDecodeErrorZ_is_ok(uint64_t o) {
22012         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
22013         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
22014         return ret_conv;
22015 }
22016
22017 void  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_free"))) TS_CResult_OutPointDecodeErrorZ_free(uint64_t _res) {
22018         if (!ptr_is_owned(_res)) return;
22019         void* _res_ptr = untag_ptr(_res);
22020         CHECK_ACCESS(_res_ptr);
22021         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
22022         FREE(untag_ptr(_res));
22023         CResult_OutPointDecodeErrorZ_free(_res_conv);
22024 }
22025
22026 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
22027         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
22028         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
22029         return tag_ptr(ret_conv, true);
22030 }
22031 int64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone_ptr"))) TS_CResult_OutPointDecodeErrorZ_clone_ptr(uint64_t arg) {
22032         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
22033         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
22034         return ret_conv;
22035 }
22036
22037 uint64_t  __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_clone"))) TS_CResult_OutPointDecodeErrorZ_clone(uint64_t orig) {
22038         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
22039         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
22040         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
22041         return tag_ptr(ret_conv, true);
22042 }
22043
22044 uint64_t  __attribute__((export_name("TS_COption_TypeZ_some"))) TS_COption_TypeZ_some(uint64_t o) {
22045         void* o_ptr = untag_ptr(o);
22046         CHECK_ACCESS(o_ptr);
22047         LDKType o_conv = *(LDKType*)(o_ptr);
22048         if (o_conv.free == LDKType_JCalls_free) {
22049                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22050                 LDKType_JCalls_cloned(&o_conv);
22051         }
22052         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22053         *ret_copy = COption_TypeZ_some(o_conv);
22054         uint64_t ret_ref = tag_ptr(ret_copy, true);
22055         return ret_ref;
22056 }
22057
22058 uint64_t  __attribute__((export_name("TS_COption_TypeZ_none"))) TS_COption_TypeZ_none() {
22059         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22060         *ret_copy = COption_TypeZ_none();
22061         uint64_t ret_ref = tag_ptr(ret_copy, true);
22062         return ret_ref;
22063 }
22064
22065 void  __attribute__((export_name("TS_COption_TypeZ_free"))) TS_COption_TypeZ_free(uint64_t _res) {
22066         if (!ptr_is_owned(_res)) return;
22067         void* _res_ptr = untag_ptr(_res);
22068         CHECK_ACCESS(_res_ptr);
22069         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
22070         FREE(untag_ptr(_res));
22071         COption_TypeZ_free(_res_conv);
22072 }
22073
22074 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
22075         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22076         *ret_copy = COption_TypeZ_clone(arg);
22077         uint64_t ret_ref = tag_ptr(ret_copy, true);
22078         return ret_ref;
22079 }
22080 int64_t  __attribute__((export_name("TS_COption_TypeZ_clone_ptr"))) TS_COption_TypeZ_clone_ptr(uint64_t arg) {
22081         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
22082         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
22083         return ret_conv;
22084 }
22085
22086 uint64_t  __attribute__((export_name("TS_COption_TypeZ_clone"))) TS_COption_TypeZ_clone(uint64_t orig) {
22087         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
22088         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
22089         *ret_copy = COption_TypeZ_clone(orig_conv);
22090         uint64_t ret_ref = tag_ptr(ret_copy, true);
22091         return ret_ref;
22092 }
22093
22094 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint64_t o) {
22095         void* o_ptr = untag_ptr(o);
22096         CHECK_ACCESS(o_ptr);
22097         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
22098         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
22099         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22100         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
22101         return tag_ptr(ret_conv, true);
22102 }
22103
22104 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_err"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint64_t e) {
22105         void* e_ptr = untag_ptr(e);
22106         CHECK_ACCESS(e_ptr);
22107         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22108         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22109         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22110         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
22111         return tag_ptr(ret_conv, true);
22112 }
22113
22114 jboolean  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_is_ok"))) TS_CResult_COption_TypeZDecodeErrorZ_is_ok(uint64_t o) {
22115         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
22116         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
22117         return ret_conv;
22118 }
22119
22120 void  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_free"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint64_t _res) {
22121         if (!ptr_is_owned(_res)) return;
22122         void* _res_ptr = untag_ptr(_res);
22123         CHECK_ACCESS(_res_ptr);
22124         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
22125         FREE(untag_ptr(_res));
22126         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
22127 }
22128
22129 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
22130         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22131         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
22132         return tag_ptr(ret_conv, true);
22133 }
22134 int64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_TypeZDecodeErrorZ_clone_ptr(uint64_t arg) {
22135         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
22136         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
22137         return ret_conv;
22138 }
22139
22140 uint64_t  __attribute__((export_name("TS_CResult_COption_TypeZDecodeErrorZ_clone"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint64_t orig) {
22141         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
22142         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22143         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
22144         return tag_ptr(ret_conv, true);
22145 }
22146
22147 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_ok"))) TS_CResult_PaymentIdPaymentErrorZ_ok(int8_tArray o) {
22148         LDKThirtyTwoBytes o_ref;
22149         CHECK(o->arr_len == 32);
22150         memcpy(o_ref.data, o->elems, 32); FREE(o);
22151         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22152         *ret_conv = CResult_PaymentIdPaymentErrorZ_ok(o_ref);
22153         return tag_ptr(ret_conv, true);
22154 }
22155
22156 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_err"))) TS_CResult_PaymentIdPaymentErrorZ_err(uint64_t e) {
22157         void* e_ptr = untag_ptr(e);
22158         CHECK_ACCESS(e_ptr);
22159         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
22160         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
22161         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22162         *ret_conv = CResult_PaymentIdPaymentErrorZ_err(e_conv);
22163         return tag_ptr(ret_conv, true);
22164 }
22165
22166 jboolean  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_is_ok"))) TS_CResult_PaymentIdPaymentErrorZ_is_ok(uint64_t o) {
22167         LDKCResult_PaymentIdPaymentErrorZ* o_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(o);
22168         jboolean ret_conv = CResult_PaymentIdPaymentErrorZ_is_ok(o_conv);
22169         return ret_conv;
22170 }
22171
22172 void  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_free"))) TS_CResult_PaymentIdPaymentErrorZ_free(uint64_t _res) {
22173         if (!ptr_is_owned(_res)) return;
22174         void* _res_ptr = untag_ptr(_res);
22175         CHECK_ACCESS(_res_ptr);
22176         LDKCResult_PaymentIdPaymentErrorZ _res_conv = *(LDKCResult_PaymentIdPaymentErrorZ*)(_res_ptr);
22177         FREE(untag_ptr(_res));
22178         CResult_PaymentIdPaymentErrorZ_free(_res_conv);
22179 }
22180
22181 static inline uint64_t CResult_PaymentIdPaymentErrorZ_clone_ptr(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR arg) {
22182         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22183         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(arg);
22184         return tag_ptr(ret_conv, true);
22185 }
22186 int64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone_ptr"))) TS_CResult_PaymentIdPaymentErrorZ_clone_ptr(uint64_t arg) {
22187         LDKCResult_PaymentIdPaymentErrorZ* arg_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(arg);
22188         int64_t ret_conv = CResult_PaymentIdPaymentErrorZ_clone_ptr(arg_conv);
22189         return ret_conv;
22190 }
22191
22192 uint64_t  __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone"))) TS_CResult_PaymentIdPaymentErrorZ_clone(uint64_t orig) {
22193         LDKCResult_PaymentIdPaymentErrorZ* orig_conv = (LDKCResult_PaymentIdPaymentErrorZ*)untag_ptr(orig);
22194         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
22195         *ret_conv = CResult_PaymentIdPaymentErrorZ_clone(orig_conv);
22196         return tag_ptr(ret_conv, true);
22197 }
22198
22199 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() {
22200         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22201         *ret_conv = CResult_NonePaymentErrorZ_ok();
22202         return tag_ptr(ret_conv, true);
22203 }
22204
22205 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) {
22206         void* e_ptr = untag_ptr(e);
22207         CHECK_ACCESS(e_ptr);
22208         LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr);
22209         e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e));
22210         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22211         *ret_conv = CResult_NonePaymentErrorZ_err(e_conv);
22212         return tag_ptr(ret_conv, true);
22213 }
22214
22215 jboolean  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) {
22216         LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o);
22217         jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv);
22218         return ret_conv;
22219 }
22220
22221 void  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) {
22222         if (!ptr_is_owned(_res)) return;
22223         void* _res_ptr = untag_ptr(_res);
22224         CHECK_ACCESS(_res_ptr);
22225         LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr);
22226         FREE(untag_ptr(_res));
22227         CResult_NonePaymentErrorZ_free(_res_conv);
22228 }
22229
22230 static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) {
22231         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22232         *ret_conv = CResult_NonePaymentErrorZ_clone(arg);
22233         return tag_ptr(ret_conv, true);
22234 }
22235 int64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) {
22236         LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg);
22237         int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv);
22238         return ret_conv;
22239 }
22240
22241 uint64_t  __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) {
22242         LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig);
22243         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
22244         *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv);
22245         return tag_ptr(ret_conv, true);
22246 }
22247
22248 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) {
22249         LDKStr o_conv = str_ref_to_owned_c(o);
22250         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22251         *ret_conv = CResult_StringErrorZ_ok(o_conv);
22252         return tag_ptr(ret_conv, true);
22253 }
22254
22255 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) {
22256         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
22257         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22258         *ret_conv = CResult_StringErrorZ_err(e_conv);
22259         return tag_ptr(ret_conv, true);
22260 }
22261
22262 jboolean  __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) {
22263         LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o);
22264         jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv);
22265         return ret_conv;
22266 }
22267
22268 void  __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) {
22269         if (!ptr_is_owned(_res)) return;
22270         void* _res_ptr = untag_ptr(_res);
22271         CHECK_ACCESS(_res_ptr);
22272         LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr);
22273         FREE(untag_ptr(_res));
22274         CResult_StringErrorZ_free(_res_conv);
22275 }
22276
22277 static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) {
22278         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22279         *ret_conv = CResult_StringErrorZ_clone(arg);
22280         return tag_ptr(ret_conv, true);
22281 }
22282 int64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) {
22283         LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg);
22284         int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv);
22285         return ret_conv;
22286 }
22287
22288 uint64_t  __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) {
22289         LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig);
22290         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
22291         *ret_conv = CResult_StringErrorZ_clone(orig_conv);
22292         return tag_ptr(ret_conv, true);
22293 }
22294
22295 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) {
22296         LDKChannelMonitorUpdate o_conv;
22297         o_conv.inner = untag_ptr(o);
22298         o_conv.is_owned = ptr_is_owned(o);
22299         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22300         o_conv = ChannelMonitorUpdate_clone(&o_conv);
22301         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22302         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
22303         return tag_ptr(ret_conv, true);
22304 }
22305
22306 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) {
22307         void* e_ptr = untag_ptr(e);
22308         CHECK_ACCESS(e_ptr);
22309         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22310         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22311         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22312         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
22313         return tag_ptr(ret_conv, true);
22314 }
22315
22316 jboolean  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) {
22317         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
22318         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
22319         return ret_conv;
22320 }
22321
22322 void  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) {
22323         if (!ptr_is_owned(_res)) return;
22324         void* _res_ptr = untag_ptr(_res);
22325         CHECK_ACCESS(_res_ptr);
22326         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
22327         FREE(untag_ptr(_res));
22328         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
22329 }
22330
22331 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
22332         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22333         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
22334         return tag_ptr(ret_conv, true);
22335 }
22336 int64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
22337         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
22338         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
22339         return ret_conv;
22340 }
22341
22342 uint64_t  __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) {
22343         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
22344         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
22345         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
22346         return tag_ptr(ret_conv, true);
22347 }
22348
22349 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) {
22350         void* o_ptr = untag_ptr(o);
22351         CHECK_ACCESS(o_ptr);
22352         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
22353         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
22354         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22355         *ret_copy = COption_MonitorEventZ_some(o_conv);
22356         uint64_t ret_ref = tag_ptr(ret_copy, true);
22357         return ret_ref;
22358 }
22359
22360 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() {
22361         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22362         *ret_copy = COption_MonitorEventZ_none();
22363         uint64_t ret_ref = tag_ptr(ret_copy, true);
22364         return ret_ref;
22365 }
22366
22367 void  __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) {
22368         if (!ptr_is_owned(_res)) return;
22369         void* _res_ptr = untag_ptr(_res);
22370         CHECK_ACCESS(_res_ptr);
22371         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
22372         FREE(untag_ptr(_res));
22373         COption_MonitorEventZ_free(_res_conv);
22374 }
22375
22376 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
22377         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22378         *ret_copy = COption_MonitorEventZ_clone(arg);
22379         uint64_t ret_ref = tag_ptr(ret_copy, true);
22380         return ret_ref;
22381 }
22382 int64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) {
22383         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
22384         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
22385         return ret_conv;
22386 }
22387
22388 uint64_t  __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) {
22389         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
22390         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
22391         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
22392         uint64_t ret_ref = tag_ptr(ret_copy, true);
22393         return ret_ref;
22394 }
22395
22396 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) {
22397         void* o_ptr = untag_ptr(o);
22398         CHECK_ACCESS(o_ptr);
22399         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
22400         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
22401         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22402         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
22403         return tag_ptr(ret_conv, true);
22404 }
22405
22406 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) {
22407         void* e_ptr = untag_ptr(e);
22408         CHECK_ACCESS(e_ptr);
22409         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22410         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22411         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22412         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
22413         return tag_ptr(ret_conv, true);
22414 }
22415
22416 jboolean  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) {
22417         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
22418         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
22419         return ret_conv;
22420 }
22421
22422 void  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) {
22423         if (!ptr_is_owned(_res)) return;
22424         void* _res_ptr = untag_ptr(_res);
22425         CHECK_ACCESS(_res_ptr);
22426         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
22427         FREE(untag_ptr(_res));
22428         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
22429 }
22430
22431 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
22432         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22433         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
22434         return tag_ptr(ret_conv, true);
22435 }
22436 int64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) {
22437         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
22438         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
22439         return ret_conv;
22440 }
22441
22442 uint64_t  __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) {
22443         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
22444         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
22445         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
22446         return tag_ptr(ret_conv, true);
22447 }
22448
22449 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) {
22450         LDKHTLCUpdate o_conv;
22451         o_conv.inner = untag_ptr(o);
22452         o_conv.is_owned = ptr_is_owned(o);
22453         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
22454         o_conv = HTLCUpdate_clone(&o_conv);
22455         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22456         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
22457         return tag_ptr(ret_conv, true);
22458 }
22459
22460 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) {
22461         void* e_ptr = untag_ptr(e);
22462         CHECK_ACCESS(e_ptr);
22463         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22464         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22465         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22466         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
22467         return tag_ptr(ret_conv, true);
22468 }
22469
22470 jboolean  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_is_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_is_ok(uint64_t o) {
22471         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
22472         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
22473         return ret_conv;
22474 }
22475
22476 void  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_free"))) TS_CResult_HTLCUpdateDecodeErrorZ_free(uint64_t _res) {
22477         if (!ptr_is_owned(_res)) return;
22478         void* _res_ptr = untag_ptr(_res);
22479         CHECK_ACCESS(_res_ptr);
22480         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
22481         FREE(untag_ptr(_res));
22482         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
22483 }
22484
22485 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
22486         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22487         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
22488         return tag_ptr(ret_conv, true);
22489 }
22490 int64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
22491         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
22492         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
22493         return ret_conv;
22494 }
22495
22496 uint64_t  __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_clone"))) TS_CResult_HTLCUpdateDecodeErrorZ_clone(uint64_t orig) {
22497         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
22498         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
22499         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
22500         return tag_ptr(ret_conv, true);
22501 }
22502
22503 static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) {
22504         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22505         *ret_conv = C2Tuple_OutPointScriptZ_clone(arg);
22506         return tag_ptr(ret_conv, true);
22507 }
22508 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone_ptr"))) TS_C2Tuple_OutPointScriptZ_clone_ptr(uint64_t arg) {
22509         LDKC2Tuple_OutPointScriptZ* arg_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(arg);
22510         int64_t ret_conv = C2Tuple_OutPointScriptZ_clone_ptr(arg_conv);
22511         return ret_conv;
22512 }
22513
22514 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_clone"))) TS_C2Tuple_OutPointScriptZ_clone(uint64_t orig) {
22515         LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(orig);
22516         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22517         *ret_conv = C2Tuple_OutPointScriptZ_clone(orig_conv);
22518         return tag_ptr(ret_conv, true);
22519 }
22520
22521 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_new"))) TS_C2Tuple_OutPointScriptZ_new(uint64_t a, int8_tArray b) {
22522         LDKOutPoint a_conv;
22523         a_conv.inner = untag_ptr(a);
22524         a_conv.is_owned = ptr_is_owned(a);
22525         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
22526         a_conv = OutPoint_clone(&a_conv);
22527         LDKCVec_u8Z b_ref;
22528         b_ref.datalen = b->arr_len;
22529         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
22530         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
22531         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
22532         *ret_conv = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
22533         return tag_ptr(ret_conv, true);
22534 }
22535
22536 void  __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_free"))) TS_C2Tuple_OutPointScriptZ_free(uint64_t _res) {
22537         if (!ptr_is_owned(_res)) return;
22538         void* _res_ptr = untag_ptr(_res);
22539         CHECK_ACCESS(_res_ptr);
22540         LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(_res_ptr);
22541         FREE(untag_ptr(_res));
22542         C2Tuple_OutPointScriptZ_free(_res_conv);
22543 }
22544
22545 static inline uint64_t C2Tuple_u32ScriptZ_clone_ptr(LDKC2Tuple_u32ScriptZ *NONNULL_PTR arg) {
22546         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
22547         *ret_conv = C2Tuple_u32ScriptZ_clone(arg);
22548         return tag_ptr(ret_conv, true);
22549 }
22550 int64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone_ptr"))) TS_C2Tuple_u32ScriptZ_clone_ptr(uint64_t arg) {
22551         LDKC2Tuple_u32ScriptZ* arg_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(arg);
22552         int64_t ret_conv = C2Tuple_u32ScriptZ_clone_ptr(arg_conv);
22553         return ret_conv;
22554 }
22555
22556 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_clone"))) TS_C2Tuple_u32ScriptZ_clone(uint64_t orig) {
22557         LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(orig);
22558         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
22559         *ret_conv = C2Tuple_u32ScriptZ_clone(orig_conv);
22560         return tag_ptr(ret_conv, true);
22561 }
22562
22563 uint64_t  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_new"))) TS_C2Tuple_u32ScriptZ_new(int32_t a, int8_tArray b) {
22564         LDKCVec_u8Z b_ref;
22565         b_ref.datalen = b->arr_len;
22566         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
22567         memcpy(b_ref.data, b->elems, b_ref.datalen); FREE(b);
22568         LDKC2Tuple_u32ScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
22569         *ret_conv = C2Tuple_u32ScriptZ_new(a, b_ref);
22570         return tag_ptr(ret_conv, true);
22571 }
22572
22573 void  __attribute__((export_name("TS_C2Tuple_u32ScriptZ_free"))) TS_C2Tuple_u32ScriptZ_free(uint64_t _res) {
22574         if (!ptr_is_owned(_res)) return;
22575         void* _res_ptr = untag_ptr(_res);
22576         CHECK_ACCESS(_res_ptr);
22577         LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_ptr);
22578         FREE(untag_ptr(_res));
22579         C2Tuple_u32ScriptZ_free(_res_conv);
22580 }
22581
22582 void  __attribute__((export_name("TS_CVec_C2Tuple_u32ScriptZZ_free"))) TS_CVec_C2Tuple_u32ScriptZZ_free(uint64_tArray _res) {
22583         LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
22584         _res_constr.datalen = _res->arr_len;
22585         if (_res_constr.datalen > 0)
22586                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
22587         else
22588                 _res_constr.data = NULL;
22589         uint64_t* _res_vals = _res->elems;
22590         for (size_t v = 0; v < _res_constr.datalen; v++) {
22591                 uint64_t _res_conv_21 = _res_vals[v];
22592                 void* _res_conv_21_ptr = untag_ptr(_res_conv_21);
22593                 CHECK_ACCESS(_res_conv_21_ptr);
22594                 LDKC2Tuple_u32ScriptZ _res_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(_res_conv_21_ptr);
22595                 FREE(untag_ptr(_res_conv_21));
22596                 _res_constr.data[v] = _res_conv_21_conv;
22597         }
22598         FREE(_res);
22599         CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
22600 }
22601
22602 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR arg) {
22603         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22604         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(arg);
22605         return tag_ptr(ret_conv, true);
22606 }
22607 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(uint64_t arg) {
22608         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(arg);
22609         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(arg_conv);
22610         return ret_conv;
22611 }
22612
22613 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(uint64_t orig) {
22614         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(orig);
22615         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22616         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
22617         return tag_ptr(ret_conv, true);
22618 }
22619
22620 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(int8_tArray a, uint64_tArray b) {
22621         LDKThirtyTwoBytes a_ref;
22622         CHECK(a->arr_len == 32);
22623         memcpy(a_ref.data, a->elems, 32); FREE(a);
22624         LDKCVec_C2Tuple_u32ScriptZZ b_constr;
22625         b_constr.datalen = b->arr_len;
22626         if (b_constr.datalen > 0)
22627                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
22628         else
22629                 b_constr.data = NULL;
22630         uint64_t* b_vals = b->elems;
22631         for (size_t v = 0; v < b_constr.datalen; v++) {
22632                 uint64_t b_conv_21 = b_vals[v];
22633                 void* b_conv_21_ptr = untag_ptr(b_conv_21);
22634                 CHECK_ACCESS(b_conv_21_ptr);
22635                 LDKC2Tuple_u32ScriptZ b_conv_21_conv = *(LDKC2Tuple_u32ScriptZ*)(b_conv_21_ptr);
22636                 b_conv_21_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)untag_ptr(b_conv_21));
22637                 b_constr.data[v] = b_conv_21_conv;
22638         }
22639         FREE(b);
22640         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
22641         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
22642         return tag_ptr(ret_conv, true);
22643 }
22644
22645 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(uint64_t _res) {
22646         if (!ptr_is_owned(_res)) return;
22647         void* _res_ptr = untag_ptr(_res);
22648         CHECK_ACCESS(_res_ptr);
22649         LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_ptr);
22650         FREE(untag_ptr(_res));
22651         C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
22652 }
22653
22654 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(uint64_tArray _res) {
22655         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
22656         _res_constr.datalen = _res->arr_len;
22657         if (_res_constr.datalen > 0)
22658                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
22659         else
22660                 _res_constr.data = NULL;
22661         uint64_t* _res_vals = _res->elems;
22662         for (size_t o = 0; o < _res_constr.datalen; o++) {
22663                 uint64_t _res_conv_40 = _res_vals[o];
22664                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
22665                 CHECK_ACCESS(_res_conv_40_ptr);
22666                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_40_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(_res_conv_40_ptr);
22667                 FREE(untag_ptr(_res_conv_40));
22668                 _res_constr.data[o] = _res_conv_40_conv;
22669         }
22670         FREE(_res);
22671         CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
22672 }
22673
22674 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
22675         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22676         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
22677         return tag_ptr(ret_conv, true);
22678 }
22679 int64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone_ptr"))) TS_C2Tuple_u32TxOutZ_clone_ptr(uint64_t arg) {
22680         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
22681         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
22682         return ret_conv;
22683 }
22684
22685 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_clone"))) TS_C2Tuple_u32TxOutZ_clone(uint64_t orig) {
22686         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
22687         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22688         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
22689         return tag_ptr(ret_conv, true);
22690 }
22691
22692 uint64_t  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_new"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint64_t b) {
22693         void* b_ptr = untag_ptr(b);
22694         CHECK_ACCESS(b_ptr);
22695         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
22696         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
22697         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
22698         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
22699         return tag_ptr(ret_conv, true);
22700 }
22701
22702 void  __attribute__((export_name("TS_C2Tuple_u32TxOutZ_free"))) TS_C2Tuple_u32TxOutZ_free(uint64_t _res) {
22703         if (!ptr_is_owned(_res)) return;
22704         void* _res_ptr = untag_ptr(_res);
22705         CHECK_ACCESS(_res_ptr);
22706         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
22707         FREE(untag_ptr(_res));
22708         C2Tuple_u32TxOutZ_free(_res_conv);
22709 }
22710
22711 void  __attribute__((export_name("TS_CVec_C2Tuple_u32TxOutZZ_free"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uint64_tArray _res) {
22712         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
22713         _res_constr.datalen = _res->arr_len;
22714         if (_res_constr.datalen > 0)
22715                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22716         else
22717                 _res_constr.data = NULL;
22718         uint64_t* _res_vals = _res->elems;
22719         for (size_t u = 0; u < _res_constr.datalen; u++) {
22720                 uint64_t _res_conv_20 = _res_vals[u];
22721                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
22722                 CHECK_ACCESS(_res_conv_20_ptr);
22723                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
22724                 FREE(untag_ptr(_res_conv_20));
22725                 _res_constr.data[u] = _res_conv_20_conv;
22726         }
22727         FREE(_res);
22728         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
22729 }
22730
22731 static inline uint64_t C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
22732         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22733         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(arg);
22734         return tag_ptr(ret_conv, true);
22735 }
22736 int64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(uint64_t arg) {
22737         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
22738         int64_t ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
22739         return ret_conv;
22740 }
22741
22742 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(uint64_t orig) {
22743         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
22744         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22745         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
22746         return tag_ptr(ret_conv, true);
22747 }
22748
22749 uint64_t  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(int8_tArray a, uint64_tArray b) {
22750         LDKThirtyTwoBytes a_ref;
22751         CHECK(a->arr_len == 32);
22752         memcpy(a_ref.data, a->elems, 32); FREE(a);
22753         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
22754         b_constr.datalen = b->arr_len;
22755         if (b_constr.datalen > 0)
22756                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
22757         else
22758                 b_constr.data = NULL;
22759         uint64_t* b_vals = b->elems;
22760         for (size_t u = 0; u < b_constr.datalen; u++) {
22761                 uint64_t b_conv_20 = b_vals[u];
22762                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
22763                 CHECK_ACCESS(b_conv_20_ptr);
22764                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
22765                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
22766                 b_constr.data[u] = b_conv_20_conv;
22767         }
22768         FREE(b);
22769         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
22770         *ret_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
22771         return tag_ptr(ret_conv, true);
22772 }
22773
22774 void  __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free"))) TS_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(uint64_t _res) {
22775         if (!ptr_is_owned(_res)) return;
22776         void* _res_ptr = untag_ptr(_res);
22777         CHECK_ACCESS(_res_ptr);
22778         LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
22779         FREE(untag_ptr(_res));
22780         C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
22781 }
22782
22783 void  __attribute__((export_name("TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(uint64_tArray _res) {
22784         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
22785         _res_constr.datalen = _res->arr_len;
22786         if (_res_constr.datalen > 0)
22787                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
22788         else
22789                 _res_constr.data = NULL;
22790         uint64_t* _res_vals = _res->elems;
22791         for (size_t n = 0; n < _res_constr.datalen; n++) {
22792                 uint64_t _res_conv_39 = _res_vals[n];
22793                 void* _res_conv_39_ptr = untag_ptr(_res_conv_39);
22794                 CHECK_ACCESS(_res_conv_39_ptr);
22795                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_39_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_39_ptr);
22796                 FREE(untag_ptr(_res_conv_39));
22797                 _res_constr.data[n] = _res_conv_39_conv;
22798         }
22799         FREE(_res);
22800         CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
22801 }
22802
22803 void  __attribute__((export_name("TS_CVec_BalanceZ_free"))) TS_CVec_BalanceZ_free(uint64_tArray _res) {
22804         LDKCVec_BalanceZ _res_constr;
22805         _res_constr.datalen = _res->arr_len;
22806         if (_res_constr.datalen > 0)
22807                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
22808         else
22809                 _res_constr.data = NULL;
22810         uint64_t* _res_vals = _res->elems;
22811         for (size_t j = 0; j < _res_constr.datalen; j++) {
22812                 uint64_t _res_conv_9 = _res_vals[j];
22813                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
22814                 CHECK_ACCESS(_res_conv_9_ptr);
22815                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
22816                 FREE(untag_ptr(_res_conv_9));
22817                 _res_constr.data[j] = _res_conv_9_conv;
22818         }
22819         FREE(_res);
22820         CVec_BalanceZ_free(_res_constr);
22821 }
22822
22823 static inline uint64_t C2Tuple_BlockHashChannelMonitorZ_clone_ptr(LDKC2Tuple_BlockHashChannelMonitorZ *NONNULL_PTR arg) {
22824         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
22825         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(arg);
22826         return tag_ptr(ret_conv, true);
22827 }
22828 int64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone_ptr(uint64_t arg) {
22829         LDKC2Tuple_BlockHashChannelMonitorZ* arg_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(arg);
22830         int64_t ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone_ptr(arg_conv);
22831         return ret_conv;
22832 }
22833
22834 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_clone"))) TS_C2Tuple_BlockHashChannelMonitorZ_clone(uint64_t orig) {
22835         LDKC2Tuple_BlockHashChannelMonitorZ* orig_conv = (LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(orig);
22836         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
22837         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_clone(orig_conv);
22838         return tag_ptr(ret_conv, true);
22839 }
22840
22841 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_new"))) TS_C2Tuple_BlockHashChannelMonitorZ_new(int8_tArray a, uint64_t b) {
22842         LDKThirtyTwoBytes a_ref;
22843         CHECK(a->arr_len == 32);
22844         memcpy(a_ref.data, a->elems, 32); FREE(a);
22845         LDKChannelMonitor b_conv;
22846         b_conv.inner = untag_ptr(b);
22847         b_conv.is_owned = ptr_is_owned(b);
22848         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
22849         b_conv = ChannelMonitor_clone(&b_conv);
22850         LDKC2Tuple_BlockHashChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
22851         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
22852         return tag_ptr(ret_conv, true);
22853 }
22854
22855 void  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_free"))) TS_C2Tuple_BlockHashChannelMonitorZ_free(uint64_t _res) {
22856         if (!ptr_is_owned(_res)) return;
22857         void* _res_ptr = untag_ptr(_res);
22858         CHECK_ACCESS(_res_ptr);
22859         LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(_res_ptr);
22860         FREE(untag_ptr(_res));
22861         C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
22862 }
22863
22864 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint64_t o) {
22865         void* o_ptr = untag_ptr(o);
22866         CHECK_ACCESS(o_ptr);
22867         LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(o_ptr);
22868         o_conv = C2Tuple_BlockHashChannelMonitorZ_clone((LDKC2Tuple_BlockHashChannelMonitorZ*)untag_ptr(o));
22869         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22870         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
22871         return tag_ptr(ret_conv, true);
22872 }
22873
22874 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(uint64_t e) {
22875         void* e_ptr = untag_ptr(e);
22876         CHECK_ACCESS(e_ptr);
22877         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
22878         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
22879         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22880         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
22881         return tag_ptr(ret_conv, true);
22882 }
22883
22884 jboolean  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(uint64_t o) {
22885         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(o);
22886         jboolean ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o_conv);
22887         return ret_conv;
22888 }
22889
22890 void  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(uint64_t _res) {
22891         if (!ptr_is_owned(_res)) return;
22892         void* _res_ptr = untag_ptr(_res);
22893         CHECK_ACCESS(_res_ptr);
22894         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(_res_ptr);
22895         FREE(untag_ptr(_res));
22896         CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
22897 }
22898
22899 static inline uint64_t CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
22900         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22901         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(arg);
22902         return tag_ptr(ret_conv, true);
22903 }
22904 int64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(uint64_t arg) {
22905         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
22906         int64_t ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
22907         return ret_conv;
22908 }
22909
22910 uint64_t  __attribute__((export_name("TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(uint64_t orig) {
22911         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
22912         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
22913         *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(orig_conv);
22914         return tag_ptr(ret_conv, true);
22915 }
22916
22917 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
22918         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22919         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
22920         return tag_ptr(ret_conv, true);
22921 }
22922 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone_ptr"))) TS_C2Tuple_PublicKeyTypeZ_clone_ptr(uint64_t arg) {
22923         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
22924         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
22925         return ret_conv;
22926 }
22927
22928 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_clone"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint64_t orig) {
22929         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
22930         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22931         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
22932         return tag_ptr(ret_conv, true);
22933 }
22934
22935 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_new"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint64_t b) {
22936         LDKPublicKey a_ref;
22937         CHECK(a->arr_len == 33);
22938         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
22939         void* b_ptr = untag_ptr(b);
22940         CHECK_ACCESS(b_ptr);
22941         LDKType b_conv = *(LDKType*)(b_ptr);
22942         if (b_conv.free == LDKType_JCalls_free) {
22943                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22944                 LDKType_JCalls_cloned(&b_conv);
22945         }
22946         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22947         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
22948         return tag_ptr(ret_conv, true);
22949 }
22950
22951 void  __attribute__((export_name("TS_C2Tuple_PublicKeyTypeZ_free"))) TS_C2Tuple_PublicKeyTypeZ_free(uint64_t _res) {
22952         if (!ptr_is_owned(_res)) return;
22953         void* _res_ptr = untag_ptr(_res);
22954         CHECK_ACCESS(_res_ptr);
22955         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
22956         FREE(untag_ptr(_res));
22957         C2Tuple_PublicKeyTypeZ_free(_res_conv);
22958 }
22959
22960 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyTypeZZ_free"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint64_tArray _res) {
22961         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
22962         _res_constr.datalen = _res->arr_len;
22963         if (_res_constr.datalen > 0)
22964                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
22965         else
22966                 _res_constr.data = NULL;
22967         uint64_t* _res_vals = _res->elems;
22968         for (size_t z = 0; z < _res_constr.datalen; z++) {
22969                 uint64_t _res_conv_25 = _res_vals[z];
22970                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
22971                 CHECK_ACCESS(_res_conv_25_ptr);
22972                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
22973                 FREE(untag_ptr(_res_conv_25));
22974                 _res_constr.data[z] = _res_conv_25_conv;
22975         }
22976         FREE(_res);
22977         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
22978 }
22979
22980 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_some"))) TS_COption_CustomOnionMessageContentsZ_some(uint64_t o) {
22981         void* o_ptr = untag_ptr(o);
22982         CHECK_ACCESS(o_ptr);
22983         LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr);
22984         if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
22985                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22986                 LDKCustomOnionMessageContents_JCalls_cloned(&o_conv);
22987         }
22988         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22989         *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv);
22990         uint64_t ret_ref = tag_ptr(ret_copy, true);
22991         return ret_ref;
22992 }
22993
22994 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_none"))) TS_COption_CustomOnionMessageContentsZ_none() {
22995         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
22996         *ret_copy = COption_CustomOnionMessageContentsZ_none();
22997         uint64_t ret_ref = tag_ptr(ret_copy, true);
22998         return ret_ref;
22999 }
23000
23001 void  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) {
23002         if (!ptr_is_owned(_res)) return;
23003         void* _res_ptr = untag_ptr(_res);
23004         CHECK_ACCESS(_res_ptr);
23005         LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr);
23006         FREE(untag_ptr(_res));
23007         COption_CustomOnionMessageContentsZ_free(_res_conv);
23008 }
23009
23010 static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) {
23011         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
23012         *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg);
23013         uint64_t ret_ref = tag_ptr(ret_copy, true);
23014         return ret_ref;
23015 }
23016 int64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) {
23017         LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg);
23018         int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv);
23019         return ret_conv;
23020 }
23021
23022 uint64_t  __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) {
23023         LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig);
23024         LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ");
23025         *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv);
23026         uint64_t ret_ref = tag_ptr(ret_copy, true);
23027         return ret_ref;
23028 }
23029
23030 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) {
23031         void* o_ptr = untag_ptr(o);
23032         CHECK_ACCESS(o_ptr);
23033         LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr);
23034         o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o));
23035         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23036         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv);
23037         return tag_ptr(ret_conv, true);
23038 }
23039
23040 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) {
23041         void* e_ptr = untag_ptr(e);
23042         CHECK_ACCESS(e_ptr);
23043         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23044         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23045         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23046         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv);
23047         return tag_ptr(ret_conv, true);
23048 }
23049
23050 jboolean  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) {
23051         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
23052         jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
23053         return ret_conv;
23054 }
23055
23056 void  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) {
23057         if (!ptr_is_owned(_res)) return;
23058         void* _res_ptr = untag_ptr(_res);
23059         CHECK_ACCESS(_res_ptr);
23060         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr);
23061         FREE(untag_ptr(_res));
23062         CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv);
23063 }
23064
23065 static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
23066         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23067         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg);
23068         return tag_ptr(ret_conv, true);
23069 }
23070 int64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) {
23071         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
23072         int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
23073         return ret_conv;
23074 }
23075
23076 uint64_t  __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) {
23077         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
23078         LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ");
23079         *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv);
23080         return tag_ptr(ret_conv, true);
23081 }
23082
23083 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) {
23084         void* o_ptr = untag_ptr(o);
23085         CHECK_ACCESS(o_ptr);
23086         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
23087         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
23088         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23089         *ret_copy = COption_NetAddressZ_some(o_conv);
23090         uint64_t ret_ref = tag_ptr(ret_copy, true);
23091         return ret_ref;
23092 }
23093
23094 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() {
23095         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23096         *ret_copy = COption_NetAddressZ_none();
23097         uint64_t ret_ref = tag_ptr(ret_copy, true);
23098         return ret_ref;
23099 }
23100
23101 void  __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) {
23102         if (!ptr_is_owned(_res)) return;
23103         void* _res_ptr = untag_ptr(_res);
23104         CHECK_ACCESS(_res_ptr);
23105         LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr);
23106         FREE(untag_ptr(_res));
23107         COption_NetAddressZ_free(_res_conv);
23108 }
23109
23110 static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) {
23111         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23112         *ret_copy = COption_NetAddressZ_clone(arg);
23113         uint64_t ret_ref = tag_ptr(ret_copy, true);
23114         return ret_ref;
23115 }
23116 int64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) {
23117         LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg);
23118         int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv);
23119         return ret_conv;
23120 }
23121
23122 uint64_t  __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) {
23123         LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig);
23124         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
23125         *ret_copy = COption_NetAddressZ_clone(orig_conv);
23126         uint64_t ret_ref = tag_ptr(ret_copy, true);
23127         return ret_ref;
23128 }
23129
23130 static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) {
23131         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
23132         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg);
23133         return tag_ptr(ret_conv, true);
23134 }
23135 int64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(uint64_t arg) {
23136         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg);
23137         int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv);
23138         return ret_conv;
23139 }
23140
23141 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone(uint64_t orig) {
23142         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig);
23143         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
23144         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv);
23145         return tag_ptr(ret_conv, true);
23146 }
23147
23148 uint64_t  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new(int8_tArray a, uint64_t b) {
23149         LDKPublicKey a_ref;
23150         CHECK(a->arr_len == 33);
23151         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
23152         void* b_ptr = untag_ptr(b);
23153         CHECK_ACCESS(b_ptr);
23154         LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr);
23155         b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b));
23156         LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
23157         *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv);
23158         return tag_ptr(ret_conv, true);
23159 }
23160
23161 void  __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free(uint64_t _res) {
23162         if (!ptr_is_owned(_res)) return;
23163         void* _res_ptr = untag_ptr(_res);
23164         CHECK_ACCESS(_res_ptr);
23165         LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr);
23166         FREE(untag_ptr(_res));
23167         C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv);
23168 }
23169
23170 void  __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(uint64_tArray _res) {
23171         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr;
23172         _res_constr.datalen = _res->arr_len;
23173         if (_res_constr.datalen > 0)
23174                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ Elements");
23175         else
23176                 _res_constr.data = NULL;
23177         uint64_t* _res_vals = _res->elems;
23178         for (size_t o = 0; o < _res_constr.datalen; o++) {
23179                 uint64_t _res_conv_40 = _res_vals[o];
23180                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
23181                 CHECK_ACCESS(_res_conv_40_ptr);
23182                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr);
23183                 FREE(untag_ptr(_res_conv_40));
23184                 _res_constr.data[o] = _res_conv_40_conv;
23185         }
23186         FREE(_res);
23187         CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr);
23188 }
23189
23190 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) {
23191         LDKCVec_u8Z o_ref;
23192         o_ref.datalen = o->arr_len;
23193         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
23194         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
23195         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23196         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
23197         return tag_ptr(ret_conv, true);
23198 }
23199
23200 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) {
23201         LDKPeerHandleError e_conv;
23202         e_conv.inner = untag_ptr(e);
23203         e_conv.is_owned = ptr_is_owned(e);
23204         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23205         e_conv = PeerHandleError_clone(&e_conv);
23206         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23207         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
23208         return tag_ptr(ret_conv, true);
23209 }
23210
23211 jboolean  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) {
23212         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
23213         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
23214         return ret_conv;
23215 }
23216
23217 void  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) {
23218         if (!ptr_is_owned(_res)) return;
23219         void* _res_ptr = untag_ptr(_res);
23220         CHECK_ACCESS(_res_ptr);
23221         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
23222         FREE(untag_ptr(_res));
23223         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
23224 }
23225
23226 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
23227         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23228         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
23229         return tag_ptr(ret_conv, true);
23230 }
23231 int64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) {
23232         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
23233         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
23234         return ret_conv;
23235 }
23236
23237 uint64_t  __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) {
23238         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
23239         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
23240         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
23241         return tag_ptr(ret_conv, true);
23242 }
23243
23244 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() {
23245         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23246         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
23247         return tag_ptr(ret_conv, true);
23248 }
23249
23250 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) {
23251         LDKPeerHandleError e_conv;
23252         e_conv.inner = untag_ptr(e);
23253         e_conv.is_owned = ptr_is_owned(e);
23254         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23255         e_conv = PeerHandleError_clone(&e_conv);
23256         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23257         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
23258         return tag_ptr(ret_conv, true);
23259 }
23260
23261 jboolean  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) {
23262         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
23263         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
23264         return ret_conv;
23265 }
23266
23267 void  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) {
23268         if (!ptr_is_owned(_res)) return;
23269         void* _res_ptr = untag_ptr(_res);
23270         CHECK_ACCESS(_res_ptr);
23271         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
23272         FREE(untag_ptr(_res));
23273         CResult_NonePeerHandleErrorZ_free(_res_conv);
23274 }
23275
23276 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
23277         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23278         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
23279         return tag_ptr(ret_conv, true);
23280 }
23281 int64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) {
23282         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
23283         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
23284         return ret_conv;
23285 }
23286
23287 uint64_t  __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) {
23288         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
23289         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
23290         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
23291         return tag_ptr(ret_conv, true);
23292 }
23293
23294 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) {
23295         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23296         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
23297         return tag_ptr(ret_conv, true);
23298 }
23299
23300 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) {
23301         LDKPeerHandleError e_conv;
23302         e_conv.inner = untag_ptr(e);
23303         e_conv.is_owned = ptr_is_owned(e);
23304         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
23305         e_conv = PeerHandleError_clone(&e_conv);
23306         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23307         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
23308         return tag_ptr(ret_conv, true);
23309 }
23310
23311 jboolean  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) {
23312         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
23313         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
23314         return ret_conv;
23315 }
23316
23317 void  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) {
23318         if (!ptr_is_owned(_res)) return;
23319         void* _res_ptr = untag_ptr(_res);
23320         CHECK_ACCESS(_res_ptr);
23321         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
23322         FREE(untag_ptr(_res));
23323         CResult_boolPeerHandleErrorZ_free(_res_conv);
23324 }
23325
23326 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
23327         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23328         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
23329         return tag_ptr(ret_conv, true);
23330 }
23331 int64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) {
23332         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
23333         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
23334         return ret_conv;
23335 }
23336
23337 uint64_t  __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) {
23338         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
23339         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
23340         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
23341         return tag_ptr(ret_conv, true);
23342 }
23343
23344 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) {
23345         void* o_ptr = untag_ptr(o);
23346         CHECK_ACCESS(o_ptr);
23347         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
23348         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
23349         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23350         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
23351         return tag_ptr(ret_conv, true);
23352 }
23353
23354 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) {
23355         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e);
23356         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23357         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
23358         return tag_ptr(ret_conv, true);
23359 }
23360
23361 jboolean  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) {
23362         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
23363         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
23364         return ret_conv;
23365 }
23366
23367 void  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) {
23368         if (!ptr_is_owned(_res)) return;
23369         void* _res_ptr = untag_ptr(_res);
23370         CHECK_ACCESS(_res_ptr);
23371         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
23372         FREE(untag_ptr(_res));
23373         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
23374 }
23375
23376 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
23377         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23378         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
23379         return tag_ptr(ret_conv, true);
23380 }
23381 int64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) {
23382         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
23383         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
23384         return ret_conv;
23385 }
23386
23387 uint64_t  __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) {
23388         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
23389         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
23390         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
23391         return tag_ptr(ret_conv, true);
23392 }
23393
23394 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_ok"))) TS_CResult_OnionMessagePathNoneZ_ok(uint64_t o) {
23395         LDKOnionMessagePath o_conv;
23396         o_conv.inner = untag_ptr(o);
23397         o_conv.is_owned = ptr_is_owned(o);
23398         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23399         o_conv = OnionMessagePath_clone(&o_conv);
23400         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
23401         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
23402         return tag_ptr(ret_conv, true);
23403 }
23404
23405 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_err"))) TS_CResult_OnionMessagePathNoneZ_err() {
23406         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
23407         *ret_conv = CResult_OnionMessagePathNoneZ_err();
23408         return tag_ptr(ret_conv, true);
23409 }
23410
23411 jboolean  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_is_ok"))) TS_CResult_OnionMessagePathNoneZ_is_ok(uint64_t o) {
23412         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
23413         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
23414         return ret_conv;
23415 }
23416
23417 void  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_free"))) TS_CResult_OnionMessagePathNoneZ_free(uint64_t _res) {
23418         if (!ptr_is_owned(_res)) return;
23419         void* _res_ptr = untag_ptr(_res);
23420         CHECK_ACCESS(_res_ptr);
23421         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
23422         FREE(untag_ptr(_res));
23423         CResult_OnionMessagePathNoneZ_free(_res_conv);
23424 }
23425
23426 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
23427         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
23428         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
23429         return tag_ptr(ret_conv, true);
23430 }
23431 int64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone_ptr"))) TS_CResult_OnionMessagePathNoneZ_clone_ptr(uint64_t arg) {
23432         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
23433         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
23434         return ret_conv;
23435 }
23436
23437 uint64_t  __attribute__((export_name("TS_CResult_OnionMessagePathNoneZ_clone"))) TS_CResult_OnionMessagePathNoneZ_clone(uint64_t orig) {
23438         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
23439         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
23440         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
23441         return tag_ptr(ret_conv, true);
23442 }
23443
23444 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() {
23445         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
23446         *ret_conv = CResult_NoneSendErrorZ_ok();
23447         return tag_ptr(ret_conv, true);
23448 }
23449
23450 uint64_t  __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) {
23451         void* e_ptr = untag_ptr(e);
23452         CHECK_ACCESS(e_ptr);
23453         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
23454         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
23455         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
23456         *ret_conv = CResult_NoneSendErrorZ_err(e_conv);
23457         return tag_ptr(ret_conv, true);
23458 }
23459
23460 jboolean  __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) {
23461         LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o);
23462         jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv);
23463         return ret_conv;
23464 }
23465
23466 void  __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) {
23467         if (!ptr_is_owned(_res)) return;
23468         void* _res_ptr = untag_ptr(_res);
23469         CHECK_ACCESS(_res_ptr);
23470         LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr);
23471         FREE(untag_ptr(_res));
23472         CResult_NoneSendErrorZ_free(_res_conv);
23473 }
23474
23475 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) {
23476         LDKBlindedPath o_conv;
23477         o_conv.inner = untag_ptr(o);
23478         o_conv.is_owned = ptr_is_owned(o);
23479         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23480         o_conv = BlindedPath_clone(&o_conv);
23481         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
23482         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
23483         return tag_ptr(ret_conv, true);
23484 }
23485
23486 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() {
23487         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
23488         *ret_conv = CResult_BlindedPathNoneZ_err();
23489         return tag_ptr(ret_conv, true);
23490 }
23491
23492 jboolean  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) {
23493         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
23494         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
23495         return ret_conv;
23496 }
23497
23498 void  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) {
23499         if (!ptr_is_owned(_res)) return;
23500         void* _res_ptr = untag_ptr(_res);
23501         CHECK_ACCESS(_res_ptr);
23502         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
23503         FREE(untag_ptr(_res));
23504         CResult_BlindedPathNoneZ_free(_res_conv);
23505 }
23506
23507 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
23508         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
23509         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
23510         return tag_ptr(ret_conv, true);
23511 }
23512 int64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) {
23513         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
23514         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
23515         return ret_conv;
23516 }
23517
23518 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) {
23519         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
23520         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
23521         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
23522         return tag_ptr(ret_conv, true);
23523 }
23524
23525 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) {
23526         LDKBlindedPath o_conv;
23527         o_conv.inner = untag_ptr(o);
23528         o_conv.is_owned = ptr_is_owned(o);
23529         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23530         o_conv = BlindedPath_clone(&o_conv);
23531         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
23532         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
23533         return tag_ptr(ret_conv, true);
23534 }
23535
23536 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) {
23537         void* e_ptr = untag_ptr(e);
23538         CHECK_ACCESS(e_ptr);
23539         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23540         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23541         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
23542         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
23543         return tag_ptr(ret_conv, true);
23544 }
23545
23546 jboolean  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) {
23547         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
23548         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
23549         return ret_conv;
23550 }
23551
23552 void  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) {
23553         if (!ptr_is_owned(_res)) return;
23554         void* _res_ptr = untag_ptr(_res);
23555         CHECK_ACCESS(_res_ptr);
23556         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
23557         FREE(untag_ptr(_res));
23558         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
23559 }
23560
23561 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
23562         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
23563         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
23564         return tag_ptr(ret_conv, true);
23565 }
23566 int64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) {
23567         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
23568         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
23569         return ret_conv;
23570 }
23571
23572 uint64_t  __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) {
23573         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
23574         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
23575         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
23576         return tag_ptr(ret_conv, true);
23577 }
23578
23579 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) {
23580         LDKBlindedHop o_conv;
23581         o_conv.inner = untag_ptr(o);
23582         o_conv.is_owned = ptr_is_owned(o);
23583         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23584         o_conv = BlindedHop_clone(&o_conv);
23585         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
23586         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
23587         return tag_ptr(ret_conv, true);
23588 }
23589
23590 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) {
23591         void* e_ptr = untag_ptr(e);
23592         CHECK_ACCESS(e_ptr);
23593         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23594         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23595         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
23596         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
23597         return tag_ptr(ret_conv, true);
23598 }
23599
23600 jboolean  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) {
23601         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
23602         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
23603         return ret_conv;
23604 }
23605
23606 void  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) {
23607         if (!ptr_is_owned(_res)) return;
23608         void* _res_ptr = untag_ptr(_res);
23609         CHECK_ACCESS(_res_ptr);
23610         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
23611         FREE(untag_ptr(_res));
23612         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
23613 }
23614
23615 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
23616         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
23617         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
23618         return tag_ptr(ret_conv, true);
23619 }
23620 int64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) {
23621         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
23622         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
23623         return ret_conv;
23624 }
23625
23626 uint64_t  __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) {
23627         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
23628         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
23629         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
23630         return tag_ptr(ret_conv, true);
23631 }
23632
23633 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) {
23634         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
23635         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
23636         return tag_ptr(ret_conv, true);
23637 }
23638
23639 uint64_t  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) {
23640         void* e_ptr = untag_ptr(e);
23641         CHECK_ACCESS(e_ptr);
23642         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
23643         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
23644         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
23645         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
23646         return tag_ptr(ret_conv, true);
23647 }
23648
23649 jboolean  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) {
23650         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
23651         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
23652         return ret_conv;
23653 }
23654
23655 void  __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) {
23656         if (!ptr_is_owned(_res)) return;
23657         void* _res_ptr = untag_ptr(_res);
23658         CHECK_ACCESS(_res_ptr);
23659         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
23660         FREE(untag_ptr(_res));
23661         CResult_u32GraphSyncErrorZ_free(_res_conv);
23662 }
23663
23664 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() {
23665         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23666         *ret_conv = CResult_NoneErrorZ_ok();
23667         return tag_ptr(ret_conv, true);
23668 }
23669
23670 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_err"))) TS_CResult_NoneErrorZ_err(uint32_t e) {
23671         LDKIOError e_conv = LDKIOError_from_js(e);
23672         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23673         *ret_conv = CResult_NoneErrorZ_err(e_conv);
23674         return tag_ptr(ret_conv, true);
23675 }
23676
23677 jboolean  __attribute__((export_name("TS_CResult_NoneErrorZ_is_ok"))) TS_CResult_NoneErrorZ_is_ok(uint64_t o) {
23678         LDKCResult_NoneErrorZ* o_conv = (LDKCResult_NoneErrorZ*)untag_ptr(o);
23679         jboolean ret_conv = CResult_NoneErrorZ_is_ok(o_conv);
23680         return ret_conv;
23681 }
23682
23683 void  __attribute__((export_name("TS_CResult_NoneErrorZ_free"))) TS_CResult_NoneErrorZ_free(uint64_t _res) {
23684         if (!ptr_is_owned(_res)) return;
23685         void* _res_ptr = untag_ptr(_res);
23686         CHECK_ACCESS(_res_ptr);
23687         LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(_res_ptr);
23688         FREE(untag_ptr(_res));
23689         CResult_NoneErrorZ_free(_res_conv);
23690 }
23691
23692 static inline uint64_t CResult_NoneErrorZ_clone_ptr(LDKCResult_NoneErrorZ *NONNULL_PTR arg) {
23693         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23694         *ret_conv = CResult_NoneErrorZ_clone(arg);
23695         return tag_ptr(ret_conv, true);
23696 }
23697 int64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone_ptr"))) TS_CResult_NoneErrorZ_clone_ptr(uint64_t arg) {
23698         LDKCResult_NoneErrorZ* arg_conv = (LDKCResult_NoneErrorZ*)untag_ptr(arg);
23699         int64_t ret_conv = CResult_NoneErrorZ_clone_ptr(arg_conv);
23700         return ret_conv;
23701 }
23702
23703 uint64_t  __attribute__((export_name("TS_CResult_NoneErrorZ_clone"))) TS_CResult_NoneErrorZ_clone(uint64_t orig) {
23704         LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)untag_ptr(orig);
23705         LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
23706         *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
23707         return tag_ptr(ret_conv, true);
23708 }
23709
23710 uint64_t  __attribute__((export_name("TS_COption_ScriptZ_some"))) TS_COption_ScriptZ_some(int8_tArray o) {
23711         LDKCVec_u8Z o_ref;
23712         o_ref.datalen = o->arr_len;
23713         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
23714         memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o);
23715         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
23716         *ret_copy = COption_ScriptZ_some(o_ref);
23717         uint64_t ret_ref = tag_ptr(ret_copy, true);
23718         return ret_ref;
23719 }
23720
23721 uint64_t  __attribute__((export_name("TS_COption_ScriptZ_none"))) TS_COption_ScriptZ_none() {
23722         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
23723         *ret_copy = COption_ScriptZ_none();
23724         uint64_t ret_ref = tag_ptr(ret_copy, true);
23725         return ret_ref;
23726 }
23727
23728 void  __attribute__((export_name("TS_COption_ScriptZ_free"))) TS_COption_ScriptZ_free(uint64_t _res) {
23729         if (!ptr_is_owned(_res)) return;
23730         void* _res_ptr = untag_ptr(_res);
23731         CHECK_ACCESS(_res_ptr);
23732         LDKCOption_ScriptZ _res_conv = *(LDKCOption_ScriptZ*)(_res_ptr);
23733         FREE(untag_ptr(_res));
23734         COption_ScriptZ_free(_res_conv);
23735 }
23736
23737 static inline uint64_t COption_ScriptZ_clone_ptr(LDKCOption_ScriptZ *NONNULL_PTR arg) {
23738         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
23739         *ret_copy = COption_ScriptZ_clone(arg);
23740         uint64_t ret_ref = tag_ptr(ret_copy, true);
23741         return ret_ref;
23742 }
23743 int64_t  __attribute__((export_name("TS_COption_ScriptZ_clone_ptr"))) TS_COption_ScriptZ_clone_ptr(uint64_t arg) {
23744         LDKCOption_ScriptZ* arg_conv = (LDKCOption_ScriptZ*)untag_ptr(arg);
23745         int64_t ret_conv = COption_ScriptZ_clone_ptr(arg_conv);
23746         return ret_conv;
23747 }
23748
23749 uint64_t  __attribute__((export_name("TS_COption_ScriptZ_clone"))) TS_COption_ScriptZ_clone(uint64_t orig) {
23750         LDKCOption_ScriptZ* orig_conv = (LDKCOption_ScriptZ*)untag_ptr(orig);
23751         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
23752         *ret_copy = COption_ScriptZ_clone(orig_conv);
23753         uint64_t ret_ref = tag_ptr(ret_copy, true);
23754         return ret_ref;
23755 }
23756
23757 uint32_t  __attribute__((export_name("TS_COption_NoneZ_some"))) TS_COption_NoneZ_some() {
23758         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some());
23759         return ret_conv;
23760 }
23761
23762 uint32_t  __attribute__((export_name("TS_COption_NoneZ_none"))) TS_COption_NoneZ_none() {
23763         uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none());
23764         return ret_conv;
23765 }
23766
23767 void  __attribute__((export_name("TS_COption_NoneZ_free"))) TS_COption_NoneZ_free(uint32_t _res) {
23768         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res);
23769         COption_NoneZ_free(_res_conv);
23770 }
23771
23772 void  __attribute__((export_name("TS_CVec_WitnessZ_free"))) TS_CVec_WitnessZ_free(ptrArray _res) {
23773         LDKCVec_WitnessZ _res_constr;
23774         _res_constr.datalen = _res->arr_len;
23775         if (_res_constr.datalen > 0)
23776                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
23777         else
23778                 _res_constr.data = NULL;
23779         int8_tArray* _res_vals = (void*) _res->elems;
23780         for (size_t m = 0; m < _res_constr.datalen; m++) {
23781                 int8_tArray _res_conv_12 = _res_vals[m];
23782                 LDKWitness _res_conv_12_ref;
23783                 _res_conv_12_ref.datalen = _res_conv_12->arr_len;
23784                 _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKWitness Bytes");
23785                 memcpy(_res_conv_12_ref.data, _res_conv_12->elems, _res_conv_12_ref.datalen); FREE(_res_conv_12);
23786                 _res_conv_12_ref.data_is_owned = true;
23787                 _res_constr.data[m] = _res_conv_12_ref;
23788         }
23789         FREE(_res);
23790         CVec_WitnessZ_free(_res_constr);
23791 }
23792
23793 uint64_t  __attribute__((export_name("TS_COption_i64Z_some"))) TS_COption_i64Z_some(int64_t o) {
23794         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23795         *ret_copy = COption_i64Z_some(o);
23796         uint64_t ret_ref = tag_ptr(ret_copy, true);
23797         return ret_ref;
23798 }
23799
23800 uint64_t  __attribute__((export_name("TS_COption_i64Z_none"))) TS_COption_i64Z_none() {
23801         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23802         *ret_copy = COption_i64Z_none();
23803         uint64_t ret_ref = tag_ptr(ret_copy, true);
23804         return ret_ref;
23805 }
23806
23807 void  __attribute__((export_name("TS_COption_i64Z_free"))) TS_COption_i64Z_free(uint64_t _res) {
23808         if (!ptr_is_owned(_res)) return;
23809         void* _res_ptr = untag_ptr(_res);
23810         CHECK_ACCESS(_res_ptr);
23811         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
23812         FREE(untag_ptr(_res));
23813         COption_i64Z_free(_res_conv);
23814 }
23815
23816 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
23817         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23818         *ret_copy = COption_i64Z_clone(arg);
23819         uint64_t ret_ref = tag_ptr(ret_copy, true);
23820         return ret_ref;
23821 }
23822 int64_t  __attribute__((export_name("TS_COption_i64Z_clone_ptr"))) TS_COption_i64Z_clone_ptr(uint64_t arg) {
23823         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
23824         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
23825         return ret_conv;
23826 }
23827
23828 uint64_t  __attribute__((export_name("TS_COption_i64Z_clone"))) TS_COption_i64Z_clone(uint64_t orig) {
23829         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
23830         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
23831         *ret_copy = COption_i64Z_clone(orig_conv);
23832         uint64_t ret_ref = tag_ptr(ret_copy, true);
23833         return ret_ref;
23834 }
23835
23836 uint64_t  __attribute__((export_name("TS_COption_TxidZ_some"))) TS_COption_TxidZ_some(int8_tArray o) {
23837         LDKThirtyTwoBytes o_ref;
23838         CHECK(o->arr_len == 32);
23839         memcpy(o_ref.data, o->elems, 32); FREE(o);
23840         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
23841         *ret_copy = COption_TxidZ_some(o_ref);
23842         uint64_t ret_ref = tag_ptr(ret_copy, true);
23843         return ret_ref;
23844 }
23845
23846 uint64_t  __attribute__((export_name("TS_COption_TxidZ_none"))) TS_COption_TxidZ_none() {
23847         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
23848         *ret_copy = COption_TxidZ_none();
23849         uint64_t ret_ref = tag_ptr(ret_copy, true);
23850         return ret_ref;
23851 }
23852
23853 void  __attribute__((export_name("TS_COption_TxidZ_free"))) TS_COption_TxidZ_free(uint64_t _res) {
23854         if (!ptr_is_owned(_res)) return;
23855         void* _res_ptr = untag_ptr(_res);
23856         CHECK_ACCESS(_res_ptr);
23857         LDKCOption_TxidZ _res_conv = *(LDKCOption_TxidZ*)(_res_ptr);
23858         FREE(untag_ptr(_res));
23859         COption_TxidZ_free(_res_conv);
23860 }
23861
23862 static inline uint64_t COption_TxidZ_clone_ptr(LDKCOption_TxidZ *NONNULL_PTR arg) {
23863         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
23864         *ret_copy = COption_TxidZ_clone(arg);
23865         uint64_t ret_ref = tag_ptr(ret_copy, true);
23866         return ret_ref;
23867 }
23868 int64_t  __attribute__((export_name("TS_COption_TxidZ_clone_ptr"))) TS_COption_TxidZ_clone_ptr(uint64_t arg) {
23869         LDKCOption_TxidZ* arg_conv = (LDKCOption_TxidZ*)untag_ptr(arg);
23870         int64_t ret_conv = COption_TxidZ_clone_ptr(arg_conv);
23871         return ret_conv;
23872 }
23873
23874 uint64_t  __attribute__((export_name("TS_COption_TxidZ_clone"))) TS_COption_TxidZ_clone(uint64_t orig) {
23875         LDKCOption_TxidZ* orig_conv = (LDKCOption_TxidZ*)untag_ptr(orig);
23876         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
23877         *ret_copy = COption_TxidZ_clone(orig_conv);
23878         uint64_t ret_ref = tag_ptr(ret_copy, true);
23879         return ret_ref;
23880 }
23881
23882 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_ok"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint64_t o) {
23883         void* o_ptr = untag_ptr(o);
23884         CHECK_ACCESS(o_ptr);
23885         LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr);
23886         o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o));
23887         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23888         *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
23889         return tag_ptr(ret_conv, true);
23890 }
23891
23892 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_err"))) TS_CResult_NetAddressDecodeErrorZ_err(uint64_t e) {
23893         void* e_ptr = untag_ptr(e);
23894         CHECK_ACCESS(e_ptr);
23895         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
23896         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
23897         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23898         *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
23899         return tag_ptr(ret_conv, true);
23900 }
23901
23902 jboolean  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_is_ok"))) TS_CResult_NetAddressDecodeErrorZ_is_ok(uint64_t o) {
23903         LDKCResult_NetAddressDecodeErrorZ* o_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(o);
23904         jboolean ret_conv = CResult_NetAddressDecodeErrorZ_is_ok(o_conv);
23905         return ret_conv;
23906 }
23907
23908 void  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_free"))) TS_CResult_NetAddressDecodeErrorZ_free(uint64_t _res) {
23909         if (!ptr_is_owned(_res)) return;
23910         void* _res_ptr = untag_ptr(_res);
23911         CHECK_ACCESS(_res_ptr);
23912         LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(_res_ptr);
23913         FREE(untag_ptr(_res));
23914         CResult_NetAddressDecodeErrorZ_free(_res_conv);
23915 }
23916
23917 static inline uint64_t CResult_NetAddressDecodeErrorZ_clone_ptr(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR arg) {
23918         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23919         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(arg);
23920         return tag_ptr(ret_conv, true);
23921 }
23922 int64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone_ptr"))) TS_CResult_NetAddressDecodeErrorZ_clone_ptr(uint64_t arg) {
23923         LDKCResult_NetAddressDecodeErrorZ* arg_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(arg);
23924         int64_t ret_conv = CResult_NetAddressDecodeErrorZ_clone_ptr(arg_conv);
23925         return ret_conv;
23926 }
23927
23928 uint64_t  __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_clone"))) TS_CResult_NetAddressDecodeErrorZ_clone(uint64_t orig) {
23929         LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(orig);
23930         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
23931         *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
23932         return tag_ptr(ret_conv, true);
23933 }
23934
23935 void  __attribute__((export_name("TS_CVec_UpdateAddHTLCZ_free"))) TS_CVec_UpdateAddHTLCZ_free(uint64_tArray _res) {
23936         LDKCVec_UpdateAddHTLCZ _res_constr;
23937         _res_constr.datalen = _res->arr_len;
23938         if (_res_constr.datalen > 0)
23939                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
23940         else
23941                 _res_constr.data = NULL;
23942         uint64_t* _res_vals = _res->elems;
23943         for (size_t p = 0; p < _res_constr.datalen; p++) {
23944                 uint64_t _res_conv_15 = _res_vals[p];
23945                 LDKUpdateAddHTLC _res_conv_15_conv;
23946                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
23947                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
23948                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
23949                 _res_constr.data[p] = _res_conv_15_conv;
23950         }
23951         FREE(_res);
23952         CVec_UpdateAddHTLCZ_free(_res_constr);
23953 }
23954
23955 void  __attribute__((export_name("TS_CVec_UpdateFulfillHTLCZ_free"))) TS_CVec_UpdateFulfillHTLCZ_free(uint64_tArray _res) {
23956         LDKCVec_UpdateFulfillHTLCZ _res_constr;
23957         _res_constr.datalen = _res->arr_len;
23958         if (_res_constr.datalen > 0)
23959                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
23960         else
23961                 _res_constr.data = NULL;
23962         uint64_t* _res_vals = _res->elems;
23963         for (size_t t = 0; t < _res_constr.datalen; t++) {
23964                 uint64_t _res_conv_19 = _res_vals[t];
23965                 LDKUpdateFulfillHTLC _res_conv_19_conv;
23966                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
23967                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
23968                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
23969                 _res_constr.data[t] = _res_conv_19_conv;
23970         }
23971         FREE(_res);
23972         CVec_UpdateFulfillHTLCZ_free(_res_constr);
23973 }
23974
23975 void  __attribute__((export_name("TS_CVec_UpdateFailHTLCZ_free"))) TS_CVec_UpdateFailHTLCZ_free(uint64_tArray _res) {
23976         LDKCVec_UpdateFailHTLCZ _res_constr;
23977         _res_constr.datalen = _res->arr_len;
23978         if (_res_constr.datalen > 0)
23979                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
23980         else
23981                 _res_constr.data = NULL;
23982         uint64_t* _res_vals = _res->elems;
23983         for (size_t q = 0; q < _res_constr.datalen; q++) {
23984                 uint64_t _res_conv_16 = _res_vals[q];
23985                 LDKUpdateFailHTLC _res_conv_16_conv;
23986                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
23987                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
23988                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
23989                 _res_constr.data[q] = _res_conv_16_conv;
23990         }
23991         FREE(_res);
23992         CVec_UpdateFailHTLCZ_free(_res_constr);
23993 }
23994
23995 void  __attribute__((export_name("TS_CVec_UpdateFailMalformedHTLCZ_free"))) TS_CVec_UpdateFailMalformedHTLCZ_free(uint64_tArray _res) {
23996         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
23997         _res_constr.datalen = _res->arr_len;
23998         if (_res_constr.datalen > 0)
23999                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
24000         else
24001                 _res_constr.data = NULL;
24002         uint64_t* _res_vals = _res->elems;
24003         for (size_t z = 0; z < _res_constr.datalen; z++) {
24004                 uint64_t _res_conv_25 = _res_vals[z];
24005                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
24006                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
24007                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
24008                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
24009                 _res_constr.data[z] = _res_conv_25_conv;
24010         }
24011         FREE(_res);
24012         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
24013 }
24014
24015 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_ok(uint64_t o) {
24016         LDKAcceptChannel o_conv;
24017         o_conv.inner = untag_ptr(o);
24018         o_conv.is_owned = ptr_is_owned(o);
24019         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24020         o_conv = AcceptChannel_clone(&o_conv);
24021         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24022         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
24023         return tag_ptr(ret_conv, true);
24024 }
24025
24026 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_err"))) TS_CResult_AcceptChannelDecodeErrorZ_err(uint64_t e) {
24027         void* e_ptr = untag_ptr(e);
24028         CHECK_ACCESS(e_ptr);
24029         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24030         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24031         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24032         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
24033         return tag_ptr(ret_conv, true);
24034 }
24035
24036 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_is_ok(uint64_t o) {
24037         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
24038         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
24039         return ret_conv;
24040 }
24041
24042 void  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_free"))) TS_CResult_AcceptChannelDecodeErrorZ_free(uint64_t _res) {
24043         if (!ptr_is_owned(_res)) return;
24044         void* _res_ptr = untag_ptr(_res);
24045         CHECK_ACCESS(_res_ptr);
24046         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
24047         FREE(untag_ptr(_res));
24048         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
24049 }
24050
24051 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
24052         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24053         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
24054         return tag_ptr(ret_conv, true);
24055 }
24056 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
24057         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
24058         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
24059         return ret_conv;
24060 }
24061
24062 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_clone"))) TS_CResult_AcceptChannelDecodeErrorZ_clone(uint64_t orig) {
24063         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
24064         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
24065         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
24066         return tag_ptr(ret_conv, true);
24067 }
24068
24069 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_ok(uint64_t o) {
24070         LDKAcceptChannelV2 o_conv;
24071         o_conv.inner = untag_ptr(o);
24072         o_conv.is_owned = ptr_is_owned(o);
24073         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24074         o_conv = AcceptChannelV2_clone(&o_conv);
24075         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
24076         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
24077         return tag_ptr(ret_conv, true);
24078 }
24079
24080 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_err"))) TS_CResult_AcceptChannelV2DecodeErrorZ_err(uint64_t e) {
24081         void* e_ptr = untag_ptr(e);
24082         CHECK_ACCESS(e_ptr);
24083         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24084         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24085         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
24086         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
24087         return tag_ptr(ret_conv, true);
24088 }
24089
24090 jboolean  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok"))) TS_CResult_AcceptChannelV2DecodeErrorZ_is_ok(uint64_t o) {
24091         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
24092         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
24093         return ret_conv;
24094 }
24095
24096 void  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_free"))) TS_CResult_AcceptChannelV2DecodeErrorZ_free(uint64_t _res) {
24097         if (!ptr_is_owned(_res)) return;
24098         void* _res_ptr = untag_ptr(_res);
24099         CHECK_ACCESS(_res_ptr);
24100         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
24101         FREE(untag_ptr(_res));
24102         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
24103 }
24104
24105 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
24106         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
24107         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
24108         return tag_ptr(ret_conv, true);
24109 }
24110 int64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
24111         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
24112         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
24113         return ret_conv;
24114 }
24115
24116 uint64_t  __attribute__((export_name("TS_CResult_AcceptChannelV2DecodeErrorZ_clone"))) TS_CResult_AcceptChannelV2DecodeErrorZ_clone(uint64_t orig) {
24117         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
24118         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
24119         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
24120         return tag_ptr(ret_conv, true);
24121 }
24122
24123 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_ok"))) TS_CResult_TxAddInputDecodeErrorZ_ok(uint64_t o) {
24124         LDKTxAddInput o_conv;
24125         o_conv.inner = untag_ptr(o);
24126         o_conv.is_owned = ptr_is_owned(o);
24127         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24128         o_conv = TxAddInput_clone(&o_conv);
24129         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
24130         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
24131         return tag_ptr(ret_conv, true);
24132 }
24133
24134 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_err"))) TS_CResult_TxAddInputDecodeErrorZ_err(uint64_t e) {
24135         void* e_ptr = untag_ptr(e);
24136         CHECK_ACCESS(e_ptr);
24137         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24138         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24139         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
24140         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
24141         return tag_ptr(ret_conv, true);
24142 }
24143
24144 jboolean  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_is_ok"))) TS_CResult_TxAddInputDecodeErrorZ_is_ok(uint64_t o) {
24145         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
24146         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
24147         return ret_conv;
24148 }
24149
24150 void  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_free"))) TS_CResult_TxAddInputDecodeErrorZ_free(uint64_t _res) {
24151         if (!ptr_is_owned(_res)) return;
24152         void* _res_ptr = untag_ptr(_res);
24153         CHECK_ACCESS(_res_ptr);
24154         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
24155         FREE(untag_ptr(_res));
24156         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
24157 }
24158
24159 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
24160         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
24161         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
24162         return tag_ptr(ret_conv, true);
24163 }
24164 int64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddInputDecodeErrorZ_clone_ptr(uint64_t arg) {
24165         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
24166         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
24167         return ret_conv;
24168 }
24169
24170 uint64_t  __attribute__((export_name("TS_CResult_TxAddInputDecodeErrorZ_clone"))) TS_CResult_TxAddInputDecodeErrorZ_clone(uint64_t orig) {
24171         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
24172         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
24173         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
24174         return tag_ptr(ret_conv, true);
24175 }
24176
24177 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_ok(uint64_t o) {
24178         LDKTxAddOutput o_conv;
24179         o_conv.inner = untag_ptr(o);
24180         o_conv.is_owned = ptr_is_owned(o);
24181         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24182         o_conv = TxAddOutput_clone(&o_conv);
24183         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
24184         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
24185         return tag_ptr(ret_conv, true);
24186 }
24187
24188 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_err"))) TS_CResult_TxAddOutputDecodeErrorZ_err(uint64_t e) {
24189         void* e_ptr = untag_ptr(e);
24190         CHECK_ACCESS(e_ptr);
24191         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24192         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24193         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
24194         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
24195         return tag_ptr(ret_conv, true);
24196 }
24197
24198 jboolean  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_is_ok"))) TS_CResult_TxAddOutputDecodeErrorZ_is_ok(uint64_t o) {
24199         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
24200         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
24201         return ret_conv;
24202 }
24203
24204 void  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_free"))) TS_CResult_TxAddOutputDecodeErrorZ_free(uint64_t _res) {
24205         if (!ptr_is_owned(_res)) return;
24206         void* _res_ptr = untag_ptr(_res);
24207         CHECK_ACCESS(_res_ptr);
24208         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
24209         FREE(untag_ptr(_res));
24210         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
24211 }
24212
24213 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
24214         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
24215         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
24216         return tag_ptr(ret_conv, true);
24217 }
24218 int64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxAddOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
24219         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
24220         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
24221         return ret_conv;
24222 }
24223
24224 uint64_t  __attribute__((export_name("TS_CResult_TxAddOutputDecodeErrorZ_clone"))) TS_CResult_TxAddOutputDecodeErrorZ_clone(uint64_t orig) {
24225         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
24226         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
24227         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
24228         return tag_ptr(ret_conv, true);
24229 }
24230
24231 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_ok(uint64_t o) {
24232         LDKTxRemoveInput o_conv;
24233         o_conv.inner = untag_ptr(o);
24234         o_conv.is_owned = ptr_is_owned(o);
24235         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24236         o_conv = TxRemoveInput_clone(&o_conv);
24237         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
24238         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
24239         return tag_ptr(ret_conv, true);
24240 }
24241
24242 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_err"))) TS_CResult_TxRemoveInputDecodeErrorZ_err(uint64_t e) {
24243         void* e_ptr = untag_ptr(e);
24244         CHECK_ACCESS(e_ptr);
24245         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24246         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24247         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
24248         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
24249         return tag_ptr(ret_conv, true);
24250 }
24251
24252 jboolean  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveInputDecodeErrorZ_is_ok(uint64_t o) {
24253         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
24254         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
24255         return ret_conv;
24256 }
24257
24258 void  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_free"))) TS_CResult_TxRemoveInputDecodeErrorZ_free(uint64_t _res) {
24259         if (!ptr_is_owned(_res)) return;
24260         void* _res_ptr = untag_ptr(_res);
24261         CHECK_ACCESS(_res_ptr);
24262         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
24263         FREE(untag_ptr(_res));
24264         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
24265 }
24266
24267 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
24268         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
24269         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
24270         return tag_ptr(ret_conv, true);
24271 }
24272 int64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone_ptr(uint64_t arg) {
24273         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
24274         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
24275         return ret_conv;
24276 }
24277
24278 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveInputDecodeErrorZ_clone"))) TS_CResult_TxRemoveInputDecodeErrorZ_clone(uint64_t orig) {
24279         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
24280         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
24281         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
24282         return tag_ptr(ret_conv, true);
24283 }
24284
24285 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_ok(uint64_t o) {
24286         LDKTxRemoveOutput o_conv;
24287         o_conv.inner = untag_ptr(o);
24288         o_conv.is_owned = ptr_is_owned(o);
24289         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24290         o_conv = TxRemoveOutput_clone(&o_conv);
24291         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
24292         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
24293         return tag_ptr(ret_conv, true);
24294 }
24295
24296 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_err"))) TS_CResult_TxRemoveOutputDecodeErrorZ_err(uint64_t e) {
24297         void* e_ptr = untag_ptr(e);
24298         CHECK_ACCESS(e_ptr);
24299         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24300         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24301         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
24302         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
24303         return tag_ptr(ret_conv, true);
24304 }
24305
24306 jboolean  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok"))) TS_CResult_TxRemoveOutputDecodeErrorZ_is_ok(uint64_t o) {
24307         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
24308         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
24309         return ret_conv;
24310 }
24311
24312 void  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_free"))) TS_CResult_TxRemoveOutputDecodeErrorZ_free(uint64_t _res) {
24313         if (!ptr_is_owned(_res)) return;
24314         void* _res_ptr = untag_ptr(_res);
24315         CHECK_ACCESS(_res_ptr);
24316         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
24317         FREE(untag_ptr(_res));
24318         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
24319 }
24320
24321 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
24322         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
24323         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
24324         return tag_ptr(ret_conv, true);
24325 }
24326 int64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(uint64_t arg) {
24327         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
24328         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
24329         return ret_conv;
24330 }
24331
24332 uint64_t  __attribute__((export_name("TS_CResult_TxRemoveOutputDecodeErrorZ_clone"))) TS_CResult_TxRemoveOutputDecodeErrorZ_clone(uint64_t orig) {
24333         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
24334         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
24335         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
24336         return tag_ptr(ret_conv, true);
24337 }
24338
24339 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_ok"))) TS_CResult_TxCompleteDecodeErrorZ_ok(uint64_t o) {
24340         LDKTxComplete o_conv;
24341         o_conv.inner = untag_ptr(o);
24342         o_conv.is_owned = ptr_is_owned(o);
24343         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24344         o_conv = TxComplete_clone(&o_conv);
24345         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24346         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
24347         return tag_ptr(ret_conv, true);
24348 }
24349
24350 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_err"))) TS_CResult_TxCompleteDecodeErrorZ_err(uint64_t e) {
24351         void* e_ptr = untag_ptr(e);
24352         CHECK_ACCESS(e_ptr);
24353         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24354         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24355         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24356         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
24357         return tag_ptr(ret_conv, true);
24358 }
24359
24360 jboolean  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_is_ok"))) TS_CResult_TxCompleteDecodeErrorZ_is_ok(uint64_t o) {
24361         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
24362         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
24363         return ret_conv;
24364 }
24365
24366 void  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_free"))) TS_CResult_TxCompleteDecodeErrorZ_free(uint64_t _res) {
24367         if (!ptr_is_owned(_res)) return;
24368         void* _res_ptr = untag_ptr(_res);
24369         CHECK_ACCESS(_res_ptr);
24370         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
24371         FREE(untag_ptr(_res));
24372         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
24373 }
24374
24375 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
24376         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24377         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
24378         return tag_ptr(ret_conv, true);
24379 }
24380 int64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone_ptr"))) TS_CResult_TxCompleteDecodeErrorZ_clone_ptr(uint64_t arg) {
24381         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
24382         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
24383         return ret_conv;
24384 }
24385
24386 uint64_t  __attribute__((export_name("TS_CResult_TxCompleteDecodeErrorZ_clone"))) TS_CResult_TxCompleteDecodeErrorZ_clone(uint64_t orig) {
24387         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
24388         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
24389         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
24390         return tag_ptr(ret_conv, true);
24391 }
24392
24393 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_ok(uint64_t o) {
24394         LDKTxSignatures o_conv;
24395         o_conv.inner = untag_ptr(o);
24396         o_conv.is_owned = ptr_is_owned(o);
24397         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24398         o_conv = TxSignatures_clone(&o_conv);
24399         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24400         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
24401         return tag_ptr(ret_conv, true);
24402 }
24403
24404 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_err"))) TS_CResult_TxSignaturesDecodeErrorZ_err(uint64_t e) {
24405         void* e_ptr = untag_ptr(e);
24406         CHECK_ACCESS(e_ptr);
24407         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24408         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24409         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24410         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
24411         return tag_ptr(ret_conv, true);
24412 }
24413
24414 jboolean  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_is_ok"))) TS_CResult_TxSignaturesDecodeErrorZ_is_ok(uint64_t o) {
24415         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
24416         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
24417         return ret_conv;
24418 }
24419
24420 void  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_free"))) TS_CResult_TxSignaturesDecodeErrorZ_free(uint64_t _res) {
24421         if (!ptr_is_owned(_res)) return;
24422         void* _res_ptr = untag_ptr(_res);
24423         CHECK_ACCESS(_res_ptr);
24424         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
24425         FREE(untag_ptr(_res));
24426         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
24427 }
24428
24429 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
24430         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24431         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
24432         return tag_ptr(ret_conv, true);
24433 }
24434 int64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_TxSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
24435         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
24436         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
24437         return ret_conv;
24438 }
24439
24440 uint64_t  __attribute__((export_name("TS_CResult_TxSignaturesDecodeErrorZ_clone"))) TS_CResult_TxSignaturesDecodeErrorZ_clone(uint64_t orig) {
24441         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
24442         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
24443         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
24444         return tag_ptr(ret_conv, true);
24445 }
24446
24447 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_ok(uint64_t o) {
24448         LDKTxInitRbf o_conv;
24449         o_conv.inner = untag_ptr(o);
24450         o_conv.is_owned = ptr_is_owned(o);
24451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24452         o_conv = TxInitRbf_clone(&o_conv);
24453         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24454         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
24455         return tag_ptr(ret_conv, true);
24456 }
24457
24458 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_err"))) TS_CResult_TxInitRbfDecodeErrorZ_err(uint64_t e) {
24459         void* e_ptr = untag_ptr(e);
24460         CHECK_ACCESS(e_ptr);
24461         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24462         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24463         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24464         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
24465         return tag_ptr(ret_conv, true);
24466 }
24467
24468 jboolean  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_is_ok"))) TS_CResult_TxInitRbfDecodeErrorZ_is_ok(uint64_t o) {
24469         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
24470         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
24471         return ret_conv;
24472 }
24473
24474 void  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_free"))) TS_CResult_TxInitRbfDecodeErrorZ_free(uint64_t _res) {
24475         if (!ptr_is_owned(_res)) return;
24476         void* _res_ptr = untag_ptr(_res);
24477         CHECK_ACCESS(_res_ptr);
24478         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
24479         FREE(untag_ptr(_res));
24480         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
24481 }
24482
24483 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
24484         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24485         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
24486         return tag_ptr(ret_conv, true);
24487 }
24488 int64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxInitRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
24489         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
24490         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
24491         return ret_conv;
24492 }
24493
24494 uint64_t  __attribute__((export_name("TS_CResult_TxInitRbfDecodeErrorZ_clone"))) TS_CResult_TxInitRbfDecodeErrorZ_clone(uint64_t orig) {
24495         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
24496         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
24497         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
24498         return tag_ptr(ret_conv, true);
24499 }
24500
24501 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_ok(uint64_t o) {
24502         LDKTxAckRbf o_conv;
24503         o_conv.inner = untag_ptr(o);
24504         o_conv.is_owned = ptr_is_owned(o);
24505         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24506         o_conv = TxAckRbf_clone(&o_conv);
24507         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24508         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
24509         return tag_ptr(ret_conv, true);
24510 }
24511
24512 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_err"))) TS_CResult_TxAckRbfDecodeErrorZ_err(uint64_t e) {
24513         void* e_ptr = untag_ptr(e);
24514         CHECK_ACCESS(e_ptr);
24515         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24516         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24517         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24518         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
24519         return tag_ptr(ret_conv, true);
24520 }
24521
24522 jboolean  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_is_ok"))) TS_CResult_TxAckRbfDecodeErrorZ_is_ok(uint64_t o) {
24523         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
24524         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
24525         return ret_conv;
24526 }
24527
24528 void  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_free"))) TS_CResult_TxAckRbfDecodeErrorZ_free(uint64_t _res) {
24529         if (!ptr_is_owned(_res)) return;
24530         void* _res_ptr = untag_ptr(_res);
24531         CHECK_ACCESS(_res_ptr);
24532         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
24533         FREE(untag_ptr(_res));
24534         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
24535 }
24536
24537 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
24538         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24539         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
24540         return tag_ptr(ret_conv, true);
24541 }
24542 int64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr"))) TS_CResult_TxAckRbfDecodeErrorZ_clone_ptr(uint64_t arg) {
24543         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
24544         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
24545         return ret_conv;
24546 }
24547
24548 uint64_t  __attribute__((export_name("TS_CResult_TxAckRbfDecodeErrorZ_clone"))) TS_CResult_TxAckRbfDecodeErrorZ_clone(uint64_t orig) {
24549         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
24550         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
24551         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
24552         return tag_ptr(ret_conv, true);
24553 }
24554
24555 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_ok"))) TS_CResult_TxAbortDecodeErrorZ_ok(uint64_t o) {
24556         LDKTxAbort o_conv;
24557         o_conv.inner = untag_ptr(o);
24558         o_conv.is_owned = ptr_is_owned(o);
24559         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24560         o_conv = TxAbort_clone(&o_conv);
24561         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24562         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
24563         return tag_ptr(ret_conv, true);
24564 }
24565
24566 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_err"))) TS_CResult_TxAbortDecodeErrorZ_err(uint64_t e) {
24567         void* e_ptr = untag_ptr(e);
24568         CHECK_ACCESS(e_ptr);
24569         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24570         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24571         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24572         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
24573         return tag_ptr(ret_conv, true);
24574 }
24575
24576 jboolean  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_is_ok"))) TS_CResult_TxAbortDecodeErrorZ_is_ok(uint64_t o) {
24577         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
24578         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
24579         return ret_conv;
24580 }
24581
24582 void  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_free"))) TS_CResult_TxAbortDecodeErrorZ_free(uint64_t _res) {
24583         if (!ptr_is_owned(_res)) return;
24584         void* _res_ptr = untag_ptr(_res);
24585         CHECK_ACCESS(_res_ptr);
24586         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
24587         FREE(untag_ptr(_res));
24588         CResult_TxAbortDecodeErrorZ_free(_res_conv);
24589 }
24590
24591 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
24592         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24593         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
24594         return tag_ptr(ret_conv, true);
24595 }
24596 int64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone_ptr"))) TS_CResult_TxAbortDecodeErrorZ_clone_ptr(uint64_t arg) {
24597         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
24598         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
24599         return ret_conv;
24600 }
24601
24602 uint64_t  __attribute__((export_name("TS_CResult_TxAbortDecodeErrorZ_clone"))) TS_CResult_TxAbortDecodeErrorZ_clone(uint64_t orig) {
24603         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
24604         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
24605         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
24606         return tag_ptr(ret_conv, true);
24607 }
24608
24609 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_ok(uint64_t o) {
24610         LDKAnnouncementSignatures o_conv;
24611         o_conv.inner = untag_ptr(o);
24612         o_conv.is_owned = ptr_is_owned(o);
24613         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24614         o_conv = AnnouncementSignatures_clone(&o_conv);
24615         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24616         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
24617         return tag_ptr(ret_conv, true);
24618 }
24619
24620 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_err(uint64_t e) {
24621         void* e_ptr = untag_ptr(e);
24622         CHECK_ACCESS(e_ptr);
24623         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24624         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24625         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24626         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
24627         return tag_ptr(ret_conv, true);
24628 }
24629
24630 jboolean  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(uint64_t o) {
24631         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
24632         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
24633         return ret_conv;
24634 }
24635
24636 void  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_free"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_free(uint64_t _res) {
24637         if (!ptr_is_owned(_res)) return;
24638         void* _res_ptr = untag_ptr(_res);
24639         CHECK_ACCESS(_res_ptr);
24640         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
24641         FREE(untag_ptr(_res));
24642         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
24643 }
24644
24645 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
24646         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24647         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
24648         return tag_ptr(ret_conv, true);
24649 }
24650 int64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(uint64_t arg) {
24651         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
24652         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
24653         return ret_conv;
24654 }
24655
24656 uint64_t  __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_clone(uint64_t orig) {
24657         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
24658         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
24659         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
24660         return tag_ptr(ret_conv, true);
24661 }
24662
24663 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_ok(uint64_t o) {
24664         LDKChannelReestablish o_conv;
24665         o_conv.inner = untag_ptr(o);
24666         o_conv.is_owned = ptr_is_owned(o);
24667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24668         o_conv = ChannelReestablish_clone(&o_conv);
24669         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24670         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
24671         return tag_ptr(ret_conv, true);
24672 }
24673
24674 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_err(uint64_t e) {
24675         void* e_ptr = untag_ptr(e);
24676         CHECK_ACCESS(e_ptr);
24677         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24678         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24679         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24680         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
24681         return tag_ptr(ret_conv, true);
24682 }
24683
24684 jboolean  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_is_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_is_ok(uint64_t o) {
24685         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
24686         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
24687         return ret_conv;
24688 }
24689
24690 void  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_free"))) TS_CResult_ChannelReestablishDecodeErrorZ_free(uint64_t _res) {
24691         if (!ptr_is_owned(_res)) return;
24692         void* _res_ptr = untag_ptr(_res);
24693         CHECK_ACCESS(_res_ptr);
24694         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
24695         FREE(untag_ptr(_res));
24696         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
24697 }
24698
24699 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
24700         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24701         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
24702         return tag_ptr(ret_conv, true);
24703 }
24704 int64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone_ptr(uint64_t arg) {
24705         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
24706         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
24707         return ret_conv;
24708 }
24709
24710 uint64_t  __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_clone"))) TS_CResult_ChannelReestablishDecodeErrorZ_clone(uint64_t orig) {
24711         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
24712         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
24713         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
24714         return tag_ptr(ret_conv, true);
24715 }
24716
24717 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_ok(uint64_t o) {
24718         LDKClosingSigned o_conv;
24719         o_conv.inner = untag_ptr(o);
24720         o_conv.is_owned = ptr_is_owned(o);
24721         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24722         o_conv = ClosingSigned_clone(&o_conv);
24723         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24724         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
24725         return tag_ptr(ret_conv, true);
24726 }
24727
24728 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_err"))) TS_CResult_ClosingSignedDecodeErrorZ_err(uint64_t e) {
24729         void* e_ptr = untag_ptr(e);
24730         CHECK_ACCESS(e_ptr);
24731         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24732         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24733         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24734         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
24735         return tag_ptr(ret_conv, true);
24736 }
24737
24738 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_is_ok(uint64_t o) {
24739         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
24740         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
24741         return ret_conv;
24742 }
24743
24744 void  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_free"))) TS_CResult_ClosingSignedDecodeErrorZ_free(uint64_t _res) {
24745         if (!ptr_is_owned(_res)) return;
24746         void* _res_ptr = untag_ptr(_res);
24747         CHECK_ACCESS(_res_ptr);
24748         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
24749         FREE(untag_ptr(_res));
24750         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
24751 }
24752
24753 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
24754         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24755         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
24756         return tag_ptr(ret_conv, true);
24757 }
24758 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24759         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
24760         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
24761         return ret_conv;
24762 }
24763
24764 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_clone"))) TS_CResult_ClosingSignedDecodeErrorZ_clone(uint64_t orig) {
24765         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
24766         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
24767         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
24768         return tag_ptr(ret_conv, true);
24769 }
24770
24771 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint64_t o) {
24772         LDKClosingSignedFeeRange o_conv;
24773         o_conv.inner = untag_ptr(o);
24774         o_conv.is_owned = ptr_is_owned(o);
24775         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24776         o_conv = ClosingSignedFeeRange_clone(&o_conv);
24777         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24778         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
24779         return tag_ptr(ret_conv, true);
24780 }
24781
24782 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_err(uint64_t e) {
24783         void* e_ptr = untag_ptr(e);
24784         CHECK_ACCESS(e_ptr);
24785         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24786         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24787         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24788         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
24789         return tag_ptr(ret_conv, true);
24790 }
24791
24792 jboolean  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(uint64_t o) {
24793         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
24794         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
24795         return ret_conv;
24796 }
24797
24798 void  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint64_t _res) {
24799         if (!ptr_is_owned(_res)) return;
24800         void* _res_ptr = untag_ptr(_res);
24801         CHECK_ACCESS(_res_ptr);
24802         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
24803         FREE(untag_ptr(_res));
24804         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
24805 }
24806
24807 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
24808         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24809         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
24810         return tag_ptr(ret_conv, true);
24811 }
24812 int64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
24813         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
24814         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
24815         return ret_conv;
24816 }
24817
24818 uint64_t  __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint64_t orig) {
24819         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
24820         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
24821         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
24822         return tag_ptr(ret_conv, true);
24823 }
24824
24825 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint64_t o) {
24826         LDKCommitmentSigned o_conv;
24827         o_conv.inner = untag_ptr(o);
24828         o_conv.is_owned = ptr_is_owned(o);
24829         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24830         o_conv = CommitmentSigned_clone(&o_conv);
24831         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24832         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
24833         return tag_ptr(ret_conv, true);
24834 }
24835
24836 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_err"))) TS_CResult_CommitmentSignedDecodeErrorZ_err(uint64_t e) {
24837         void* e_ptr = untag_ptr(e);
24838         CHECK_ACCESS(e_ptr);
24839         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24840         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24841         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24842         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
24843         return tag_ptr(ret_conv, true);
24844 }
24845
24846 jboolean  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_is_ok"))) TS_CResult_CommitmentSignedDecodeErrorZ_is_ok(uint64_t o) {
24847         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
24848         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
24849         return ret_conv;
24850 }
24851
24852 void  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_free"))) TS_CResult_CommitmentSignedDecodeErrorZ_free(uint64_t _res) {
24853         if (!ptr_is_owned(_res)) return;
24854         void* _res_ptr = untag_ptr(_res);
24855         CHECK_ACCESS(_res_ptr);
24856         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
24857         FREE(untag_ptr(_res));
24858         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
24859 }
24860
24861 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
24862         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24863         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
24864         return tag_ptr(ret_conv, true);
24865 }
24866 int64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24867         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
24868         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
24869         return ret_conv;
24870 }
24871
24872 uint64_t  __attribute__((export_name("TS_CResult_CommitmentSignedDecodeErrorZ_clone"))) TS_CResult_CommitmentSignedDecodeErrorZ_clone(uint64_t orig) {
24873         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
24874         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
24875         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
24876         return tag_ptr(ret_conv, true);
24877 }
24878
24879 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_ok(uint64_t o) {
24880         LDKFundingCreated o_conv;
24881         o_conv.inner = untag_ptr(o);
24882         o_conv.is_owned = ptr_is_owned(o);
24883         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24884         o_conv = FundingCreated_clone(&o_conv);
24885         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24886         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
24887         return tag_ptr(ret_conv, true);
24888 }
24889
24890 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_err"))) TS_CResult_FundingCreatedDecodeErrorZ_err(uint64_t e) {
24891         void* e_ptr = untag_ptr(e);
24892         CHECK_ACCESS(e_ptr);
24893         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24894         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24895         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24896         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
24897         return tag_ptr(ret_conv, true);
24898 }
24899
24900 jboolean  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_is_ok"))) TS_CResult_FundingCreatedDecodeErrorZ_is_ok(uint64_t o) {
24901         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
24902         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
24903         return ret_conv;
24904 }
24905
24906 void  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_free"))) TS_CResult_FundingCreatedDecodeErrorZ_free(uint64_t _res) {
24907         if (!ptr_is_owned(_res)) return;
24908         void* _res_ptr = untag_ptr(_res);
24909         CHECK_ACCESS(_res_ptr);
24910         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
24911         FREE(untag_ptr(_res));
24912         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
24913 }
24914
24915 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
24916         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24917         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
24918         return tag_ptr(ret_conv, true);
24919 }
24920 int64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingCreatedDecodeErrorZ_clone_ptr(uint64_t arg) {
24921         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
24922         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
24923         return ret_conv;
24924 }
24925
24926 uint64_t  __attribute__((export_name("TS_CResult_FundingCreatedDecodeErrorZ_clone"))) TS_CResult_FundingCreatedDecodeErrorZ_clone(uint64_t orig) {
24927         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
24928         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
24929         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
24930         return tag_ptr(ret_conv, true);
24931 }
24932
24933 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_ok"))) TS_CResult_FundingSignedDecodeErrorZ_ok(uint64_t o) {
24934         LDKFundingSigned o_conv;
24935         o_conv.inner = untag_ptr(o);
24936         o_conv.is_owned = ptr_is_owned(o);
24937         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24938         o_conv = FundingSigned_clone(&o_conv);
24939         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24940         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
24941         return tag_ptr(ret_conv, true);
24942 }
24943
24944 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_err"))) TS_CResult_FundingSignedDecodeErrorZ_err(uint64_t e) {
24945         void* e_ptr = untag_ptr(e);
24946         CHECK_ACCESS(e_ptr);
24947         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24948         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24949         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24950         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
24951         return tag_ptr(ret_conv, true);
24952 }
24953
24954 jboolean  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_is_ok"))) TS_CResult_FundingSignedDecodeErrorZ_is_ok(uint64_t o) {
24955         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
24956         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
24957         return ret_conv;
24958 }
24959
24960 void  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_free"))) TS_CResult_FundingSignedDecodeErrorZ_free(uint64_t _res) {
24961         if (!ptr_is_owned(_res)) return;
24962         void* _res_ptr = untag_ptr(_res);
24963         CHECK_ACCESS(_res_ptr);
24964         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
24965         FREE(untag_ptr(_res));
24966         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
24967 }
24968
24969 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
24970         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24971         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
24972         return tag_ptr(ret_conv, true);
24973 }
24974 int64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone_ptr"))) TS_CResult_FundingSignedDecodeErrorZ_clone_ptr(uint64_t arg) {
24975         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
24976         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
24977         return ret_conv;
24978 }
24979
24980 uint64_t  __attribute__((export_name("TS_CResult_FundingSignedDecodeErrorZ_clone"))) TS_CResult_FundingSignedDecodeErrorZ_clone(uint64_t orig) {
24981         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
24982         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
24983         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
24984         return tag_ptr(ret_conv, true);
24985 }
24986
24987 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_ok(uint64_t o) {
24988         LDKChannelReady o_conv;
24989         o_conv.inner = untag_ptr(o);
24990         o_conv.is_owned = ptr_is_owned(o);
24991         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24992         o_conv = ChannelReady_clone(&o_conv);
24993         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
24994         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
24995         return tag_ptr(ret_conv, true);
24996 }
24997
24998 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_err"))) TS_CResult_ChannelReadyDecodeErrorZ_err(uint64_t e) {
24999         void* e_ptr = untag_ptr(e);
25000         CHECK_ACCESS(e_ptr);
25001         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25002         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25003         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
25004         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
25005         return tag_ptr(ret_conv, true);
25006 }
25007
25008 jboolean  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_is_ok"))) TS_CResult_ChannelReadyDecodeErrorZ_is_ok(uint64_t o) {
25009         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
25010         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
25011         return ret_conv;
25012 }
25013
25014 void  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_free"))) TS_CResult_ChannelReadyDecodeErrorZ_free(uint64_t _res) {
25015         if (!ptr_is_owned(_res)) return;
25016         void* _res_ptr = untag_ptr(_res);
25017         CHECK_ACCESS(_res_ptr);
25018         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
25019         FREE(untag_ptr(_res));
25020         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
25021 }
25022
25023 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
25024         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
25025         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
25026         return tag_ptr(ret_conv, true);
25027 }
25028 int64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelReadyDecodeErrorZ_clone_ptr(uint64_t arg) {
25029         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
25030         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
25031         return ret_conv;
25032 }
25033
25034 uint64_t  __attribute__((export_name("TS_CResult_ChannelReadyDecodeErrorZ_clone"))) TS_CResult_ChannelReadyDecodeErrorZ_clone(uint64_t orig) {
25035         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
25036         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
25037         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
25038         return tag_ptr(ret_conv, true);
25039 }
25040
25041 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_ok"))) TS_CResult_InitDecodeErrorZ_ok(uint64_t o) {
25042         LDKInit o_conv;
25043         o_conv.inner = untag_ptr(o);
25044         o_conv.is_owned = ptr_is_owned(o);
25045         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25046         o_conv = Init_clone(&o_conv);
25047         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
25048         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
25049         return tag_ptr(ret_conv, true);
25050 }
25051
25052 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_err"))) TS_CResult_InitDecodeErrorZ_err(uint64_t e) {
25053         void* e_ptr = untag_ptr(e);
25054         CHECK_ACCESS(e_ptr);
25055         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25056         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25057         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
25058         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
25059         return tag_ptr(ret_conv, true);
25060 }
25061
25062 jboolean  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_is_ok"))) TS_CResult_InitDecodeErrorZ_is_ok(uint64_t o) {
25063         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
25064         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
25065         return ret_conv;
25066 }
25067
25068 void  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_free"))) TS_CResult_InitDecodeErrorZ_free(uint64_t _res) {
25069         if (!ptr_is_owned(_res)) return;
25070         void* _res_ptr = untag_ptr(_res);
25071         CHECK_ACCESS(_res_ptr);
25072         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
25073         FREE(untag_ptr(_res));
25074         CResult_InitDecodeErrorZ_free(_res_conv);
25075 }
25076
25077 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
25078         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
25079         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
25080         return tag_ptr(ret_conv, true);
25081 }
25082 int64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone_ptr"))) TS_CResult_InitDecodeErrorZ_clone_ptr(uint64_t arg) {
25083         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
25084         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
25085         return ret_conv;
25086 }
25087
25088 uint64_t  __attribute__((export_name("TS_CResult_InitDecodeErrorZ_clone"))) TS_CResult_InitDecodeErrorZ_clone(uint64_t orig) {
25089         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
25090         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
25091         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
25092         return tag_ptr(ret_conv, true);
25093 }
25094
25095 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_ok"))) TS_CResult_OpenChannelDecodeErrorZ_ok(uint64_t o) {
25096         LDKOpenChannel o_conv;
25097         o_conv.inner = untag_ptr(o);
25098         o_conv.is_owned = ptr_is_owned(o);
25099         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25100         o_conv = OpenChannel_clone(&o_conv);
25101         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
25102         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
25103         return tag_ptr(ret_conv, true);
25104 }
25105
25106 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_err"))) TS_CResult_OpenChannelDecodeErrorZ_err(uint64_t e) {
25107         void* e_ptr = untag_ptr(e);
25108         CHECK_ACCESS(e_ptr);
25109         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25110         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25111         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
25112         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
25113         return tag_ptr(ret_conv, true);
25114 }
25115
25116 jboolean  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_is_ok"))) TS_CResult_OpenChannelDecodeErrorZ_is_ok(uint64_t o) {
25117         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
25118         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
25119         return ret_conv;
25120 }
25121
25122 void  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_free"))) TS_CResult_OpenChannelDecodeErrorZ_free(uint64_t _res) {
25123         if (!ptr_is_owned(_res)) return;
25124         void* _res_ptr = untag_ptr(_res);
25125         CHECK_ACCESS(_res_ptr);
25126         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
25127         FREE(untag_ptr(_res));
25128         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
25129 }
25130
25131 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
25132         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
25133         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
25134         return tag_ptr(ret_conv, true);
25135 }
25136 int64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelDecodeErrorZ_clone_ptr(uint64_t arg) {
25137         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
25138         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
25139         return ret_conv;
25140 }
25141
25142 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelDecodeErrorZ_clone"))) TS_CResult_OpenChannelDecodeErrorZ_clone(uint64_t orig) {
25143         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
25144         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
25145         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
25146         return tag_ptr(ret_conv, true);
25147 }
25148
25149 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_ok(uint64_t o) {
25150         LDKOpenChannelV2 o_conv;
25151         o_conv.inner = untag_ptr(o);
25152         o_conv.is_owned = ptr_is_owned(o);
25153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25154         o_conv = OpenChannelV2_clone(&o_conv);
25155         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
25156         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
25157         return tag_ptr(ret_conv, true);
25158 }
25159
25160 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_err"))) TS_CResult_OpenChannelV2DecodeErrorZ_err(uint64_t e) {
25161         void* e_ptr = untag_ptr(e);
25162         CHECK_ACCESS(e_ptr);
25163         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25164         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25165         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
25166         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
25167         return tag_ptr(ret_conv, true);
25168 }
25169
25170 jboolean  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_is_ok"))) TS_CResult_OpenChannelV2DecodeErrorZ_is_ok(uint64_t o) {
25171         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
25172         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
25173         return ret_conv;
25174 }
25175
25176 void  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_free"))) TS_CResult_OpenChannelV2DecodeErrorZ_free(uint64_t _res) {
25177         if (!ptr_is_owned(_res)) return;
25178         void* _res_ptr = untag_ptr(_res);
25179         CHECK_ACCESS(_res_ptr);
25180         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
25181         FREE(untag_ptr(_res));
25182         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
25183 }
25184
25185 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
25186         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
25187         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
25188         return tag_ptr(ret_conv, true);
25189 }
25190 int64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone_ptr(uint64_t arg) {
25191         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
25192         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
25193         return ret_conv;
25194 }
25195
25196 uint64_t  __attribute__((export_name("TS_CResult_OpenChannelV2DecodeErrorZ_clone"))) TS_CResult_OpenChannelV2DecodeErrorZ_clone(uint64_t orig) {
25197         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
25198         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
25199         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
25200         return tag_ptr(ret_conv, true);
25201 }
25202
25203 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_ok(uint64_t o) {
25204         LDKRevokeAndACK o_conv;
25205         o_conv.inner = untag_ptr(o);
25206         o_conv.is_owned = ptr_is_owned(o);
25207         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25208         o_conv = RevokeAndACK_clone(&o_conv);
25209         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
25210         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
25211         return tag_ptr(ret_conv, true);
25212 }
25213
25214 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_err"))) TS_CResult_RevokeAndACKDecodeErrorZ_err(uint64_t e) {
25215         void* e_ptr = untag_ptr(e);
25216         CHECK_ACCESS(e_ptr);
25217         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25218         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25219         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
25220         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
25221         return tag_ptr(ret_conv, true);
25222 }
25223
25224 jboolean  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_is_ok"))) TS_CResult_RevokeAndACKDecodeErrorZ_is_ok(uint64_t o) {
25225         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
25226         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
25227         return ret_conv;
25228 }
25229
25230 void  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_free"))) TS_CResult_RevokeAndACKDecodeErrorZ_free(uint64_t _res) {
25231         if (!ptr_is_owned(_res)) return;
25232         void* _res_ptr = untag_ptr(_res);
25233         CHECK_ACCESS(_res_ptr);
25234         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
25235         FREE(untag_ptr(_res));
25236         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
25237 }
25238
25239 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
25240         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
25241         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
25242         return tag_ptr(ret_conv, true);
25243 }
25244 int64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone_ptr(uint64_t arg) {
25245         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
25246         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
25247         return ret_conv;
25248 }
25249
25250 uint64_t  __attribute__((export_name("TS_CResult_RevokeAndACKDecodeErrorZ_clone"))) TS_CResult_RevokeAndACKDecodeErrorZ_clone(uint64_t orig) {
25251         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
25252         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
25253         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
25254         return tag_ptr(ret_conv, true);
25255 }
25256
25257 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_ok"))) TS_CResult_ShutdownDecodeErrorZ_ok(uint64_t o) {
25258         LDKShutdown o_conv;
25259         o_conv.inner = untag_ptr(o);
25260         o_conv.is_owned = ptr_is_owned(o);
25261         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25262         o_conv = Shutdown_clone(&o_conv);
25263         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
25264         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
25265         return tag_ptr(ret_conv, true);
25266 }
25267
25268 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_err"))) TS_CResult_ShutdownDecodeErrorZ_err(uint64_t e) {
25269         void* e_ptr = untag_ptr(e);
25270         CHECK_ACCESS(e_ptr);
25271         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25272         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25273         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
25274         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
25275         return tag_ptr(ret_conv, true);
25276 }
25277
25278 jboolean  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_is_ok"))) TS_CResult_ShutdownDecodeErrorZ_is_ok(uint64_t o) {
25279         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
25280         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
25281         return ret_conv;
25282 }
25283
25284 void  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_free"))) TS_CResult_ShutdownDecodeErrorZ_free(uint64_t _res) {
25285         if (!ptr_is_owned(_res)) return;
25286         void* _res_ptr = untag_ptr(_res);
25287         CHECK_ACCESS(_res_ptr);
25288         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
25289         FREE(untag_ptr(_res));
25290         CResult_ShutdownDecodeErrorZ_free(_res_conv);
25291 }
25292
25293 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
25294         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
25295         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
25296         return tag_ptr(ret_conv, true);
25297 }
25298 int64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone_ptr"))) TS_CResult_ShutdownDecodeErrorZ_clone_ptr(uint64_t arg) {
25299         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
25300         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
25301         return ret_conv;
25302 }
25303
25304 uint64_t  __attribute__((export_name("TS_CResult_ShutdownDecodeErrorZ_clone"))) TS_CResult_ShutdownDecodeErrorZ_clone(uint64_t orig) {
25305         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
25306         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
25307         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
25308         return tag_ptr(ret_conv, true);
25309 }
25310
25311 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_ok(uint64_t o) {
25312         LDKUpdateFailHTLC o_conv;
25313         o_conv.inner = untag_ptr(o);
25314         o_conv.is_owned = ptr_is_owned(o);
25315         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25316         o_conv = UpdateFailHTLC_clone(&o_conv);
25317         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
25318         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
25319         return tag_ptr(ret_conv, true);
25320 }
25321
25322 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_err(uint64_t e) {
25323         void* e_ptr = untag_ptr(e);
25324         CHECK_ACCESS(e_ptr);
25325         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25326         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25327         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
25328         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
25329         return tag_ptr(ret_conv, true);
25330 }
25331
25332 jboolean  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_is_ok(uint64_t o) {
25333         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
25334         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
25335         return ret_conv;
25336 }
25337
25338 void  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_free(uint64_t _res) {
25339         if (!ptr_is_owned(_res)) return;
25340         void* _res_ptr = untag_ptr(_res);
25341         CHECK_ACCESS(_res_ptr);
25342         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
25343         FREE(untag_ptr(_res));
25344         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
25345 }
25346
25347 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
25348         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
25349         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
25350         return tag_ptr(ret_conv, true);
25351 }
25352 int64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25353         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
25354         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
25355         return ret_conv;
25356 }
25357
25358 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailHTLCDecodeErrorZ_clone(uint64_t orig) {
25359         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
25360         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
25361         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
25362         return tag_ptr(ret_conv, true);
25363 }
25364
25365 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(uint64_t o) {
25366         LDKUpdateFailMalformedHTLC o_conv;
25367         o_conv.inner = untag_ptr(o);
25368         o_conv.is_owned = ptr_is_owned(o);
25369         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25370         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
25371         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25372         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
25373         return tag_ptr(ret_conv, true);
25374 }
25375
25376 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(uint64_t e) {
25377         void* e_ptr = untag_ptr(e);
25378         CHECK_ACCESS(e_ptr);
25379         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25380         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25381         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25382         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
25383         return tag_ptr(ret_conv, true);
25384 }
25385
25386 jboolean  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(uint64_t o) {
25387         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
25388         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
25389         return ret_conv;
25390 }
25391
25392 void  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(uint64_t _res) {
25393         if (!ptr_is_owned(_res)) return;
25394         void* _res_ptr = untag_ptr(_res);
25395         CHECK_ACCESS(_res_ptr);
25396         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
25397         FREE(untag_ptr(_res));
25398         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
25399 }
25400
25401 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
25402         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25403         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
25404         return tag_ptr(ret_conv, true);
25405 }
25406 int64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25407         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
25408         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
25409         return ret_conv;
25410 }
25411
25412 uint64_t  __attribute__((export_name("TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(uint64_t orig) {
25413         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
25414         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
25415         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
25416         return tag_ptr(ret_conv, true);
25417 }
25418
25419 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_ok(uint64_t o) {
25420         LDKUpdateFee o_conv;
25421         o_conv.inner = untag_ptr(o);
25422         o_conv.is_owned = ptr_is_owned(o);
25423         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25424         o_conv = UpdateFee_clone(&o_conv);
25425         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25426         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
25427         return tag_ptr(ret_conv, true);
25428 }
25429
25430 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_err"))) TS_CResult_UpdateFeeDecodeErrorZ_err(uint64_t e) {
25431         void* e_ptr = untag_ptr(e);
25432         CHECK_ACCESS(e_ptr);
25433         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25434         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25435         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25436         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
25437         return tag_ptr(ret_conv, true);
25438 }
25439
25440 jboolean  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_is_ok"))) TS_CResult_UpdateFeeDecodeErrorZ_is_ok(uint64_t o) {
25441         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
25442         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
25443         return ret_conv;
25444 }
25445
25446 void  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_free"))) TS_CResult_UpdateFeeDecodeErrorZ_free(uint64_t _res) {
25447         if (!ptr_is_owned(_res)) return;
25448         void* _res_ptr = untag_ptr(_res);
25449         CHECK_ACCESS(_res_ptr);
25450         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
25451         FREE(untag_ptr(_res));
25452         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
25453 }
25454
25455 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
25456         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25457         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
25458         return tag_ptr(ret_conv, true);
25459 }
25460 int64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFeeDecodeErrorZ_clone_ptr(uint64_t arg) {
25461         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
25462         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
25463         return ret_conv;
25464 }
25465
25466 uint64_t  __attribute__((export_name("TS_CResult_UpdateFeeDecodeErrorZ_clone"))) TS_CResult_UpdateFeeDecodeErrorZ_clone(uint64_t orig) {
25467         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
25468         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
25469         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
25470         return tag_ptr(ret_conv, true);
25471 }
25472
25473 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_ok(uint64_t o) {
25474         LDKUpdateFulfillHTLC o_conv;
25475         o_conv.inner = untag_ptr(o);
25476         o_conv.is_owned = ptr_is_owned(o);
25477         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25478         o_conv = UpdateFulfillHTLC_clone(&o_conv);
25479         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25480         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
25481         return tag_ptr(ret_conv, true);
25482 }
25483
25484 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_err(uint64_t e) {
25485         void* e_ptr = untag_ptr(e);
25486         CHECK_ACCESS(e_ptr);
25487         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25488         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25489         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25490         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
25491         return tag_ptr(ret_conv, true);
25492 }
25493
25494 jboolean  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(uint64_t o) {
25495         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
25496         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
25497         return ret_conv;
25498 }
25499
25500 void  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_free(uint64_t _res) {
25501         if (!ptr_is_owned(_res)) return;
25502         void* _res_ptr = untag_ptr(_res);
25503         CHECK_ACCESS(_res_ptr);
25504         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
25505         FREE(untag_ptr(_res));
25506         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
25507 }
25508
25509 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
25510         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25511         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
25512         return tag_ptr(ret_conv, true);
25513 }
25514 int64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25515         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
25516         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
25517         return ret_conv;
25518 }
25519
25520 uint64_t  __attribute__((export_name("TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateFulfillHTLCDecodeErrorZ_clone(uint64_t orig) {
25521         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
25522         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
25523         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
25524         return tag_ptr(ret_conv, true);
25525 }
25526
25527 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_ok(uint64_t o) {
25528         LDKUpdateAddHTLC o_conv;
25529         o_conv.inner = untag_ptr(o);
25530         o_conv.is_owned = ptr_is_owned(o);
25531         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25532         o_conv = UpdateAddHTLC_clone(&o_conv);
25533         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25534         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
25535         return tag_ptr(ret_conv, true);
25536 }
25537
25538 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_err"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_err(uint64_t e) {
25539         void* e_ptr = untag_ptr(e);
25540         CHECK_ACCESS(e_ptr);
25541         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25542         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25543         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25544         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
25545         return tag_ptr(ret_conv, true);
25546 }
25547
25548 jboolean  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_is_ok(uint64_t o) {
25549         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
25550         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
25551         return ret_conv;
25552 }
25553
25554 void  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_free"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_free(uint64_t _res) {
25555         if (!ptr_is_owned(_res)) return;
25556         void* _res_ptr = untag_ptr(_res);
25557         CHECK_ACCESS(_res_ptr);
25558         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
25559         FREE(untag_ptr(_res));
25560         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
25561 }
25562
25563 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
25564         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25565         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
25566         return tag_ptr(ret_conv, true);
25567 }
25568 int64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(uint64_t arg) {
25569         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
25570         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
25571         return ret_conv;
25572 }
25573
25574 uint64_t  __attribute__((export_name("TS_CResult_UpdateAddHTLCDecodeErrorZ_clone"))) TS_CResult_UpdateAddHTLCDecodeErrorZ_clone(uint64_t orig) {
25575         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
25576         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
25577         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
25578         return tag_ptr(ret_conv, true);
25579 }
25580
25581 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_ok"))) TS_CResult_OnionMessageDecodeErrorZ_ok(uint64_t o) {
25582         LDKOnionMessage o_conv;
25583         o_conv.inner = untag_ptr(o);
25584         o_conv.is_owned = ptr_is_owned(o);
25585         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25586         o_conv = OnionMessage_clone(&o_conv);
25587         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25588         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
25589         return tag_ptr(ret_conv, true);
25590 }
25591
25592 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_err"))) TS_CResult_OnionMessageDecodeErrorZ_err(uint64_t e) {
25593         void* e_ptr = untag_ptr(e);
25594         CHECK_ACCESS(e_ptr);
25595         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25596         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25597         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25598         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
25599         return tag_ptr(ret_conv, true);
25600 }
25601
25602 jboolean  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_is_ok"))) TS_CResult_OnionMessageDecodeErrorZ_is_ok(uint64_t o) {
25603         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
25604         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
25605         return ret_conv;
25606 }
25607
25608 void  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_free"))) TS_CResult_OnionMessageDecodeErrorZ_free(uint64_t _res) {
25609         if (!ptr_is_owned(_res)) return;
25610         void* _res_ptr = untag_ptr(_res);
25611         CHECK_ACCESS(_res_ptr);
25612         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
25613         FREE(untag_ptr(_res));
25614         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
25615 }
25616
25617 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
25618         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25619         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
25620         return tag_ptr(ret_conv, true);
25621 }
25622 int64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone_ptr"))) TS_CResult_OnionMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
25623         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
25624         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
25625         return ret_conv;
25626 }
25627
25628 uint64_t  __attribute__((export_name("TS_CResult_OnionMessageDecodeErrorZ_clone"))) TS_CResult_OnionMessageDecodeErrorZ_clone(uint64_t orig) {
25629         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
25630         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
25631         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
25632         return tag_ptr(ret_conv, true);
25633 }
25634
25635 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_ok"))) TS_CResult_PingDecodeErrorZ_ok(uint64_t o) {
25636         LDKPing o_conv;
25637         o_conv.inner = untag_ptr(o);
25638         o_conv.is_owned = ptr_is_owned(o);
25639         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25640         o_conv = Ping_clone(&o_conv);
25641         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25642         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
25643         return tag_ptr(ret_conv, true);
25644 }
25645
25646 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_err"))) TS_CResult_PingDecodeErrorZ_err(uint64_t e) {
25647         void* e_ptr = untag_ptr(e);
25648         CHECK_ACCESS(e_ptr);
25649         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25650         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25651         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25652         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
25653         return tag_ptr(ret_conv, true);
25654 }
25655
25656 jboolean  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_is_ok"))) TS_CResult_PingDecodeErrorZ_is_ok(uint64_t o) {
25657         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
25658         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
25659         return ret_conv;
25660 }
25661
25662 void  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_free"))) TS_CResult_PingDecodeErrorZ_free(uint64_t _res) {
25663         if (!ptr_is_owned(_res)) return;
25664         void* _res_ptr = untag_ptr(_res);
25665         CHECK_ACCESS(_res_ptr);
25666         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
25667         FREE(untag_ptr(_res));
25668         CResult_PingDecodeErrorZ_free(_res_conv);
25669 }
25670
25671 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
25672         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25673         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
25674         return tag_ptr(ret_conv, true);
25675 }
25676 int64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone_ptr"))) TS_CResult_PingDecodeErrorZ_clone_ptr(uint64_t arg) {
25677         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
25678         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
25679         return ret_conv;
25680 }
25681
25682 uint64_t  __attribute__((export_name("TS_CResult_PingDecodeErrorZ_clone"))) TS_CResult_PingDecodeErrorZ_clone(uint64_t orig) {
25683         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
25684         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
25685         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
25686         return tag_ptr(ret_conv, true);
25687 }
25688
25689 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_ok"))) TS_CResult_PongDecodeErrorZ_ok(uint64_t o) {
25690         LDKPong o_conv;
25691         o_conv.inner = untag_ptr(o);
25692         o_conv.is_owned = ptr_is_owned(o);
25693         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25694         o_conv = Pong_clone(&o_conv);
25695         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25696         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
25697         return tag_ptr(ret_conv, true);
25698 }
25699
25700 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_err"))) TS_CResult_PongDecodeErrorZ_err(uint64_t e) {
25701         void* e_ptr = untag_ptr(e);
25702         CHECK_ACCESS(e_ptr);
25703         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25704         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25705         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25706         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
25707         return tag_ptr(ret_conv, true);
25708 }
25709
25710 jboolean  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_is_ok"))) TS_CResult_PongDecodeErrorZ_is_ok(uint64_t o) {
25711         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
25712         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
25713         return ret_conv;
25714 }
25715
25716 void  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_free"))) TS_CResult_PongDecodeErrorZ_free(uint64_t _res) {
25717         if (!ptr_is_owned(_res)) return;
25718         void* _res_ptr = untag_ptr(_res);
25719         CHECK_ACCESS(_res_ptr);
25720         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
25721         FREE(untag_ptr(_res));
25722         CResult_PongDecodeErrorZ_free(_res_conv);
25723 }
25724
25725 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
25726         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25727         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
25728         return tag_ptr(ret_conv, true);
25729 }
25730 int64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone_ptr"))) TS_CResult_PongDecodeErrorZ_clone_ptr(uint64_t arg) {
25731         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
25732         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
25733         return ret_conv;
25734 }
25735
25736 uint64_t  __attribute__((export_name("TS_CResult_PongDecodeErrorZ_clone"))) TS_CResult_PongDecodeErrorZ_clone(uint64_t orig) {
25737         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
25738         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
25739         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
25740         return tag_ptr(ret_conv, true);
25741 }
25742
25743 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
25744         LDKUnsignedChannelAnnouncement o_conv;
25745         o_conv.inner = untag_ptr(o);
25746         o_conv.is_owned = ptr_is_owned(o);
25747         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25748         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
25749         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25750         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
25751         return tag_ptr(ret_conv, true);
25752 }
25753
25754 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
25755         void* e_ptr = untag_ptr(e);
25756         CHECK_ACCESS(e_ptr);
25757         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25758         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25759         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25760         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
25761         return tag_ptr(ret_conv, true);
25762 }
25763
25764 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25765         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25766         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25767         return ret_conv;
25768 }
25769
25770 void  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
25771         if (!ptr_is_owned(_res)) return;
25772         void* _res_ptr = untag_ptr(_res);
25773         CHECK_ACCESS(_res_ptr);
25774         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25775         FREE(untag_ptr(_res));
25776         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
25777 }
25778
25779 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25780         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25781         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
25782         return tag_ptr(ret_conv, true);
25783 }
25784 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25785         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25786         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25787         return ret_conv;
25788 }
25789
25790 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25791         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25792         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
25793         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25794         return tag_ptr(ret_conv, true);
25795 }
25796
25797 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_ok(uint64_t o) {
25798         LDKChannelAnnouncement o_conv;
25799         o_conv.inner = untag_ptr(o);
25800         o_conv.is_owned = ptr_is_owned(o);
25801         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25802         o_conv = ChannelAnnouncement_clone(&o_conv);
25803         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25804         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
25805         return tag_ptr(ret_conv, true);
25806 }
25807
25808 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_err"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_err(uint64_t e) {
25809         void* e_ptr = untag_ptr(e);
25810         CHECK_ACCESS(e_ptr);
25811         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25812         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25813         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25814         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
25815         return tag_ptr(ret_conv, true);
25816 }
25817
25818 jboolean  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
25819         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
25820         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
25821         return ret_conv;
25822 }
25823
25824 void  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_free"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_free(uint64_t _res) {
25825         if (!ptr_is_owned(_res)) return;
25826         void* _res_ptr = untag_ptr(_res);
25827         CHECK_ACCESS(_res_ptr);
25828         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
25829         FREE(untag_ptr(_res));
25830         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
25831 }
25832
25833 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
25834         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25835         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
25836         return tag_ptr(ret_conv, true);
25837 }
25838 int64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
25839         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
25840         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
25841         return ret_conv;
25842 }
25843
25844 uint64_t  __attribute__((export_name("TS_CResult_ChannelAnnouncementDecodeErrorZ_clone"))) TS_CResult_ChannelAnnouncementDecodeErrorZ_clone(uint64_t orig) {
25845         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
25846         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
25847         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
25848         return tag_ptr(ret_conv, true);
25849 }
25850
25851 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25852         LDKUnsignedChannelUpdate o_conv;
25853         o_conv.inner = untag_ptr(o);
25854         o_conv.is_owned = ptr_is_owned(o);
25855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25856         o_conv = UnsignedChannelUpdate_clone(&o_conv);
25857         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25858         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
25859         return tag_ptr(ret_conv, true);
25860 }
25861
25862 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_err(uint64_t e) {
25863         void* e_ptr = untag_ptr(e);
25864         CHECK_ACCESS(e_ptr);
25865         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25866         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25867         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25868         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
25869         return tag_ptr(ret_conv, true);
25870 }
25871
25872 jboolean  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25873         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
25874         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
25875         return ret_conv;
25876 }
25877
25878 void  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25879         if (!ptr_is_owned(_res)) return;
25880         void* _res_ptr = untag_ptr(_res);
25881         CHECK_ACCESS(_res_ptr);
25882         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
25883         FREE(untag_ptr(_res));
25884         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
25885 }
25886
25887 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25888         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25889         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
25890         return tag_ptr(ret_conv, true);
25891 }
25892 int64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25893         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25894         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25895         return ret_conv;
25896 }
25897
25898 uint64_t  __attribute__((export_name("TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone"))) TS_CResult_UnsignedChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25899         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25900         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
25901         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
25902         return tag_ptr(ret_conv, true);
25903 }
25904
25905 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_ok(uint64_t o) {
25906         LDKChannelUpdate o_conv;
25907         o_conv.inner = untag_ptr(o);
25908         o_conv.is_owned = ptr_is_owned(o);
25909         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25910         o_conv = ChannelUpdate_clone(&o_conv);
25911         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25912         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
25913         return tag_ptr(ret_conv, true);
25914 }
25915
25916 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_err"))) TS_CResult_ChannelUpdateDecodeErrorZ_err(uint64_t e) {
25917         void* e_ptr = untag_ptr(e);
25918         CHECK_ACCESS(e_ptr);
25919         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25920         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25921         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25922         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
25923         return tag_ptr(ret_conv, true);
25924 }
25925
25926 jboolean  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelUpdateDecodeErrorZ_is_ok(uint64_t o) {
25927         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
25928         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
25929         return ret_conv;
25930 }
25931
25932 void  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_free"))) TS_CResult_ChannelUpdateDecodeErrorZ_free(uint64_t _res) {
25933         if (!ptr_is_owned(_res)) return;
25934         void* _res_ptr = untag_ptr(_res);
25935         CHECK_ACCESS(_res_ptr);
25936         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
25937         FREE(untag_ptr(_res));
25938         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
25939 }
25940
25941 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
25942         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25943         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
25944         return tag_ptr(ret_conv, true);
25945 }
25946 int64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone_ptr(uint64_t arg) {
25947         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
25948         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
25949         return ret_conv;
25950 }
25951
25952 uint64_t  __attribute__((export_name("TS_CResult_ChannelUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelUpdateDecodeErrorZ_clone(uint64_t orig) {
25953         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
25954         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
25955         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
25956         return tag_ptr(ret_conv, true);
25957 }
25958
25959 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_ok(uint64_t o) {
25960         LDKErrorMessage o_conv;
25961         o_conv.inner = untag_ptr(o);
25962         o_conv.is_owned = ptr_is_owned(o);
25963         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25964         o_conv = ErrorMessage_clone(&o_conv);
25965         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25966         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
25967         return tag_ptr(ret_conv, true);
25968 }
25969
25970 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_err"))) TS_CResult_ErrorMessageDecodeErrorZ_err(uint64_t e) {
25971         void* e_ptr = untag_ptr(e);
25972         CHECK_ACCESS(e_ptr);
25973         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25974         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25975         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25976         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
25977         return tag_ptr(ret_conv, true);
25978 }
25979
25980 jboolean  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_is_ok"))) TS_CResult_ErrorMessageDecodeErrorZ_is_ok(uint64_t o) {
25981         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
25982         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
25983         return ret_conv;
25984 }
25985
25986 void  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_free"))) TS_CResult_ErrorMessageDecodeErrorZ_free(uint64_t _res) {
25987         if (!ptr_is_owned(_res)) return;
25988         void* _res_ptr = untag_ptr(_res);
25989         CHECK_ACCESS(_res_ptr);
25990         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
25991         FREE(untag_ptr(_res));
25992         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
25993 }
25994
25995 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
25996         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
25997         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
25998         return tag_ptr(ret_conv, true);
25999 }
26000 int64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr"))) TS_CResult_ErrorMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
26001         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
26002         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
26003         return ret_conv;
26004 }
26005
26006 uint64_t  __attribute__((export_name("TS_CResult_ErrorMessageDecodeErrorZ_clone"))) TS_CResult_ErrorMessageDecodeErrorZ_clone(uint64_t orig) {
26007         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
26008         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
26009         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
26010         return tag_ptr(ret_conv, true);
26011 }
26012
26013 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_ok"))) TS_CResult_WarningMessageDecodeErrorZ_ok(uint64_t o) {
26014         LDKWarningMessage o_conv;
26015         o_conv.inner = untag_ptr(o);
26016         o_conv.is_owned = ptr_is_owned(o);
26017         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26018         o_conv = WarningMessage_clone(&o_conv);
26019         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
26020         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
26021         return tag_ptr(ret_conv, true);
26022 }
26023
26024 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_err"))) TS_CResult_WarningMessageDecodeErrorZ_err(uint64_t e) {
26025         void* e_ptr = untag_ptr(e);
26026         CHECK_ACCESS(e_ptr);
26027         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26028         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26029         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
26030         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
26031         return tag_ptr(ret_conv, true);
26032 }
26033
26034 jboolean  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_is_ok"))) TS_CResult_WarningMessageDecodeErrorZ_is_ok(uint64_t o) {
26035         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
26036         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
26037         return ret_conv;
26038 }
26039
26040 void  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_free"))) TS_CResult_WarningMessageDecodeErrorZ_free(uint64_t _res) {
26041         if (!ptr_is_owned(_res)) return;
26042         void* _res_ptr = untag_ptr(_res);
26043         CHECK_ACCESS(_res_ptr);
26044         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
26045         FREE(untag_ptr(_res));
26046         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
26047 }
26048
26049 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
26050         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
26051         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
26052         return tag_ptr(ret_conv, true);
26053 }
26054 int64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone_ptr"))) TS_CResult_WarningMessageDecodeErrorZ_clone_ptr(uint64_t arg) {
26055         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
26056         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
26057         return ret_conv;
26058 }
26059
26060 uint64_t  __attribute__((export_name("TS_CResult_WarningMessageDecodeErrorZ_clone"))) TS_CResult_WarningMessageDecodeErrorZ_clone(uint64_t orig) {
26061         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
26062         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
26063         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
26064         return tag_ptr(ret_conv, true);
26065 }
26066
26067 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
26068         LDKUnsignedNodeAnnouncement o_conv;
26069         o_conv.inner = untag_ptr(o);
26070         o_conv.is_owned = ptr_is_owned(o);
26071         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26072         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
26073         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
26074         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
26075         return tag_ptr(ret_conv, true);
26076 }
26077
26078 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(uint64_t e) {
26079         void* e_ptr = untag_ptr(e);
26080         CHECK_ACCESS(e_ptr);
26081         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26082         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26083         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
26084         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
26085         return tag_ptr(ret_conv, true);
26086 }
26087
26088 jboolean  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
26089         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
26090         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
26091         return ret_conv;
26092 }
26093
26094 void  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
26095         if (!ptr_is_owned(_res)) return;
26096         void* _res_ptr = untag_ptr(_res);
26097         CHECK_ACCESS(_res_ptr);
26098         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
26099         FREE(untag_ptr(_res));
26100         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
26101 }
26102
26103 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
26104         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
26105         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
26106         return tag_ptr(ret_conv, true);
26107 }
26108 int64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
26109         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
26110         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
26111         return ret_conv;
26112 }
26113
26114 uint64_t  __attribute__((export_name("TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
26115         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
26116         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
26117         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
26118         return tag_ptr(ret_conv, true);
26119 }
26120
26121 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_ok(uint64_t o) {
26122         LDKNodeAnnouncement o_conv;
26123         o_conv.inner = untag_ptr(o);
26124         o_conv.is_owned = ptr_is_owned(o);
26125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26126         o_conv = NodeAnnouncement_clone(&o_conv);
26127         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
26128         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
26129         return tag_ptr(ret_conv, true);
26130 }
26131
26132 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_err"))) TS_CResult_NodeAnnouncementDecodeErrorZ_err(uint64_t e) {
26133         void* e_ptr = untag_ptr(e);
26134         CHECK_ACCESS(e_ptr);
26135         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26136         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26137         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
26138         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
26139         return tag_ptr(ret_conv, true);
26140 }
26141
26142 jboolean  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok"))) TS_CResult_NodeAnnouncementDecodeErrorZ_is_ok(uint64_t o) {
26143         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
26144         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
26145         return ret_conv;
26146 }
26147
26148 void  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_free"))) TS_CResult_NodeAnnouncementDecodeErrorZ_free(uint64_t _res) {
26149         if (!ptr_is_owned(_res)) return;
26150         void* _res_ptr = untag_ptr(_res);
26151         CHECK_ACCESS(_res_ptr);
26152         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
26153         FREE(untag_ptr(_res));
26154         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
26155 }
26156
26157 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
26158         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
26159         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
26160         return tag_ptr(ret_conv, true);
26161 }
26162 int64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(uint64_t arg) {
26163         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
26164         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
26165         return ret_conv;
26166 }
26167
26168 uint64_t  __attribute__((export_name("TS_CResult_NodeAnnouncementDecodeErrorZ_clone"))) TS_CResult_NodeAnnouncementDecodeErrorZ_clone(uint64_t orig) {
26169         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
26170         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
26171         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
26172         return tag_ptr(ret_conv, true);
26173 }
26174
26175 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_ok(uint64_t o) {
26176         LDKQueryShortChannelIds o_conv;
26177         o_conv.inner = untag_ptr(o);
26178         o_conv.is_owned = ptr_is_owned(o);
26179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26180         o_conv = QueryShortChannelIds_clone(&o_conv);
26181         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
26182         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
26183         return tag_ptr(ret_conv, true);
26184 }
26185
26186 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_err"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_err(uint64_t e) {
26187         void* e_ptr = untag_ptr(e);
26188         CHECK_ACCESS(e_ptr);
26189         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26190         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26191         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
26192         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
26193         return tag_ptr(ret_conv, true);
26194 }
26195
26196 jboolean  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(uint64_t o) {
26197         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
26198         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
26199         return ret_conv;
26200 }
26201
26202 void  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_free"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_free(uint64_t _res) {
26203         if (!ptr_is_owned(_res)) return;
26204         void* _res_ptr = untag_ptr(_res);
26205         CHECK_ACCESS(_res_ptr);
26206         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
26207         FREE(untag_ptr(_res));
26208         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
26209 }
26210
26211 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
26212         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
26213         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
26214         return tag_ptr(ret_conv, true);
26215 }
26216 int64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(uint64_t arg) {
26217         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
26218         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
26219         return ret_conv;
26220 }
26221
26222 uint64_t  __attribute__((export_name("TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone"))) TS_CResult_QueryShortChannelIdsDecodeErrorZ_clone(uint64_t orig) {
26223         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
26224         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
26225         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
26226         return tag_ptr(ret_conv, true);
26227 }
26228
26229 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(uint64_t o) {
26230         LDKReplyShortChannelIdsEnd o_conv;
26231         o_conv.inner = untag_ptr(o);
26232         o_conv.is_owned = ptr_is_owned(o);
26233         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26234         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
26235         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
26236         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
26237         return tag_ptr(ret_conv, true);
26238 }
26239
26240 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(uint64_t e) {
26241         void* e_ptr = untag_ptr(e);
26242         CHECK_ACCESS(e_ptr);
26243         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26244         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26245         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
26246         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
26247         return tag_ptr(ret_conv, true);
26248 }
26249
26250 jboolean  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(uint64_t o) {
26251         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
26252         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
26253         return ret_conv;
26254 }
26255
26256 void  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(uint64_t _res) {
26257         if (!ptr_is_owned(_res)) return;
26258         void* _res_ptr = untag_ptr(_res);
26259         CHECK_ACCESS(_res_ptr);
26260         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
26261         FREE(untag_ptr(_res));
26262         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
26263 }
26264
26265 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
26266         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
26267         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
26268         return tag_ptr(ret_conv, true);
26269 }
26270 int64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(uint64_t arg) {
26271         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
26272         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
26273         return ret_conv;
26274 }
26275
26276 uint64_t  __attribute__((export_name("TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone"))) TS_CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(uint64_t orig) {
26277         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
26278         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
26279         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
26280         return tag_ptr(ret_conv, true);
26281 }
26282
26283 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_ok(uint64_t o) {
26284         LDKQueryChannelRange o_conv;
26285         o_conv.inner = untag_ptr(o);
26286         o_conv.is_owned = ptr_is_owned(o);
26287         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26288         o_conv = QueryChannelRange_clone(&o_conv);
26289         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
26290         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
26291         return tag_ptr(ret_conv, true);
26292 }
26293
26294 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_err"))) TS_CResult_QueryChannelRangeDecodeErrorZ_err(uint64_t e) {
26295         void* e_ptr = untag_ptr(e);
26296         CHECK_ACCESS(e_ptr);
26297         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26298         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26299         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
26300         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
26301         return tag_ptr(ret_conv, true);
26302 }
26303
26304 jboolean  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_QueryChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
26305         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
26306         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
26307         return ret_conv;
26308 }
26309
26310 void  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_free"))) TS_CResult_QueryChannelRangeDecodeErrorZ_free(uint64_t _res) {
26311         if (!ptr_is_owned(_res)) return;
26312         void* _res_ptr = untag_ptr(_res);
26313         CHECK_ACCESS(_res_ptr);
26314         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
26315         FREE(untag_ptr(_res));
26316         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
26317 }
26318
26319 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
26320         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
26321         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
26322         return tag_ptr(ret_conv, true);
26323 }
26324 int64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
26325         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
26326         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
26327         return ret_conv;
26328 }
26329
26330 uint64_t  __attribute__((export_name("TS_CResult_QueryChannelRangeDecodeErrorZ_clone"))) TS_CResult_QueryChannelRangeDecodeErrorZ_clone(uint64_t orig) {
26331         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
26332         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
26333         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
26334         return tag_ptr(ret_conv, true);
26335 }
26336
26337 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_ok(uint64_t o) {
26338         LDKReplyChannelRange o_conv;
26339         o_conv.inner = untag_ptr(o);
26340         o_conv.is_owned = ptr_is_owned(o);
26341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26342         o_conv = ReplyChannelRange_clone(&o_conv);
26343         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26344         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
26345         return tag_ptr(ret_conv, true);
26346 }
26347
26348 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_err"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_err(uint64_t e) {
26349         void* e_ptr = untag_ptr(e);
26350         CHECK_ACCESS(e_ptr);
26351         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26352         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26353         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26354         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
26355         return tag_ptr(ret_conv, true);
26356 }
26357
26358 jboolean  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_is_ok(uint64_t o) {
26359         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
26360         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
26361         return ret_conv;
26362 }
26363
26364 void  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_free"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_free(uint64_t _res) {
26365         if (!ptr_is_owned(_res)) return;
26366         void* _res_ptr = untag_ptr(_res);
26367         CHECK_ACCESS(_res_ptr);
26368         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
26369         FREE(untag_ptr(_res));
26370         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
26371 }
26372
26373 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
26374         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26375         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
26376         return tag_ptr(ret_conv, true);
26377 }
26378 int64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(uint64_t arg) {
26379         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
26380         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
26381         return ret_conv;
26382 }
26383
26384 uint64_t  __attribute__((export_name("TS_CResult_ReplyChannelRangeDecodeErrorZ_clone"))) TS_CResult_ReplyChannelRangeDecodeErrorZ_clone(uint64_t orig) {
26385         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
26386         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
26387         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
26388         return tag_ptr(ret_conv, true);
26389 }
26390
26391 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_ok(uint64_t o) {
26392         LDKGossipTimestampFilter o_conv;
26393         o_conv.inner = untag_ptr(o);
26394         o_conv.is_owned = ptr_is_owned(o);
26395         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26396         o_conv = GossipTimestampFilter_clone(&o_conv);
26397         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26398         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
26399         return tag_ptr(ret_conv, true);
26400 }
26401
26402 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_err"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_err(uint64_t e) {
26403         void* e_ptr = untag_ptr(e);
26404         CHECK_ACCESS(e_ptr);
26405         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26406         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26407         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26408         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
26409         return tag_ptr(ret_conv, true);
26410 }
26411
26412 jboolean  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_is_ok(uint64_t o) {
26413         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
26414         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
26415         return ret_conv;
26416 }
26417
26418 void  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_free"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_free(uint64_t _res) {
26419         if (!ptr_is_owned(_res)) return;
26420         void* _res_ptr = untag_ptr(_res);
26421         CHECK_ACCESS(_res_ptr);
26422         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
26423         FREE(untag_ptr(_res));
26424         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
26425 }
26426
26427 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
26428         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26429         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
26430         return tag_ptr(ret_conv, true);
26431 }
26432 int64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(uint64_t arg) {
26433         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
26434         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
26435         return ret_conv;
26436 }
26437
26438 uint64_t  __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErrorZ_clone"))) TS_CResult_GossipTimestampFilterDecodeErrorZ_clone(uint64_t orig) {
26439         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
26440         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
26441         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
26442         return tag_ptr(ret_conv, true);
26443 }
26444
26445 uint64_t  __attribute__((export_name("TS_COption_KeyPairZ_some"))) TS_COption_KeyPairZ_some(int8_tArray o) {
26446         LDKSecretKey o_ref;
26447         CHECK(o->arr_len == 32);
26448         memcpy(o_ref.bytes, o->elems, 32); FREE(o);
26449         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26450         *ret_copy = COption_KeyPairZ_some(o_ref);
26451         uint64_t ret_ref = tag_ptr(ret_copy, true);
26452         return ret_ref;
26453 }
26454
26455 uint64_t  __attribute__((export_name("TS_COption_KeyPairZ_none"))) TS_COption_KeyPairZ_none() {
26456         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26457         *ret_copy = COption_KeyPairZ_none();
26458         uint64_t ret_ref = tag_ptr(ret_copy, true);
26459         return ret_ref;
26460 }
26461
26462 void  __attribute__((export_name("TS_COption_KeyPairZ_free"))) TS_COption_KeyPairZ_free(uint64_t _res) {
26463         if (!ptr_is_owned(_res)) return;
26464         void* _res_ptr = untag_ptr(_res);
26465         CHECK_ACCESS(_res_ptr);
26466         LDKCOption_KeyPairZ _res_conv = *(LDKCOption_KeyPairZ*)(_res_ptr);
26467         FREE(untag_ptr(_res));
26468         COption_KeyPairZ_free(_res_conv);
26469 }
26470
26471 static inline uint64_t COption_KeyPairZ_clone_ptr(LDKCOption_KeyPairZ *NONNULL_PTR arg) {
26472         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26473         *ret_copy = COption_KeyPairZ_clone(arg);
26474         uint64_t ret_ref = tag_ptr(ret_copy, true);
26475         return ret_ref;
26476 }
26477 int64_t  __attribute__((export_name("TS_COption_KeyPairZ_clone_ptr"))) TS_COption_KeyPairZ_clone_ptr(uint64_t arg) {
26478         LDKCOption_KeyPairZ* arg_conv = (LDKCOption_KeyPairZ*)untag_ptr(arg);
26479         int64_t ret_conv = COption_KeyPairZ_clone_ptr(arg_conv);
26480         return ret_conv;
26481 }
26482
26483 uint64_t  __attribute__((export_name("TS_COption_KeyPairZ_clone"))) TS_COption_KeyPairZ_clone(uint64_t orig) {
26484         LDKCOption_KeyPairZ* orig_conv = (LDKCOption_KeyPairZ*)untag_ptr(orig);
26485         LDKCOption_KeyPairZ *ret_copy = MALLOC(sizeof(LDKCOption_KeyPairZ), "LDKCOption_KeyPairZ");
26486         *ret_copy = COption_KeyPairZ_clone(orig_conv);
26487         uint64_t ret_ref = tag_ptr(ret_copy, true);
26488         return ret_ref;
26489 }
26490
26491 uint64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_ok"))) TS_CResult_COption_KeyPairZNoneZ_ok(uint64_t o) {
26492         void* o_ptr = untag_ptr(o);
26493         CHECK_ACCESS(o_ptr);
26494         LDKCOption_KeyPairZ o_conv = *(LDKCOption_KeyPairZ*)(o_ptr);
26495         o_conv = COption_KeyPairZ_clone((LDKCOption_KeyPairZ*)untag_ptr(o));
26496         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26497         *ret_conv = CResult_COption_KeyPairZNoneZ_ok(o_conv);
26498         return tag_ptr(ret_conv, true);
26499 }
26500
26501 uint64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_err"))) TS_CResult_COption_KeyPairZNoneZ_err() {
26502         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26503         *ret_conv = CResult_COption_KeyPairZNoneZ_err();
26504         return tag_ptr(ret_conv, true);
26505 }
26506
26507 jboolean  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_is_ok"))) TS_CResult_COption_KeyPairZNoneZ_is_ok(uint64_t o) {
26508         LDKCResult_COption_KeyPairZNoneZ* o_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(o);
26509         jboolean ret_conv = CResult_COption_KeyPairZNoneZ_is_ok(o_conv);
26510         return ret_conv;
26511 }
26512
26513 void  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_free"))) TS_CResult_COption_KeyPairZNoneZ_free(uint64_t _res) {
26514         if (!ptr_is_owned(_res)) return;
26515         void* _res_ptr = untag_ptr(_res);
26516         CHECK_ACCESS(_res_ptr);
26517         LDKCResult_COption_KeyPairZNoneZ _res_conv = *(LDKCResult_COption_KeyPairZNoneZ*)(_res_ptr);
26518         FREE(untag_ptr(_res));
26519         CResult_COption_KeyPairZNoneZ_free(_res_conv);
26520 }
26521
26522 static inline uint64_t CResult_COption_KeyPairZNoneZ_clone_ptr(LDKCResult_COption_KeyPairZNoneZ *NONNULL_PTR arg) {
26523         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26524         *ret_conv = CResult_COption_KeyPairZNoneZ_clone(arg);
26525         return tag_ptr(ret_conv, true);
26526 }
26527 int64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_clone_ptr"))) TS_CResult_COption_KeyPairZNoneZ_clone_ptr(uint64_t arg) {
26528         LDKCResult_COption_KeyPairZNoneZ* arg_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(arg);
26529         int64_t ret_conv = CResult_COption_KeyPairZNoneZ_clone_ptr(arg_conv);
26530         return ret_conv;
26531 }
26532
26533 uint64_t  __attribute__((export_name("TS_CResult_COption_KeyPairZNoneZ_clone"))) TS_CResult_COption_KeyPairZNoneZ_clone(uint64_t orig) {
26534         LDKCResult_COption_KeyPairZNoneZ* orig_conv = (LDKCResult_COption_KeyPairZNoneZ*)untag_ptr(orig);
26535         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
26536         *ret_conv = CResult_COption_KeyPairZNoneZ_clone(orig_conv);
26537         return tag_ptr(ret_conv, true);
26538 }
26539
26540 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_ok(uint64_t o) {
26541         LDKInvoiceError o_conv;
26542         o_conv.inner = untag_ptr(o);
26543         o_conv.is_owned = ptr_is_owned(o);
26544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26545         o_conv = InvoiceError_clone(&o_conv);
26546         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
26547         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
26548         return tag_ptr(ret_conv, true);
26549 }
26550
26551 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_err"))) TS_CResult_InvoiceErrorDecodeErrorZ_err(uint64_t e) {
26552         void* e_ptr = untag_ptr(e);
26553         CHECK_ACCESS(e_ptr);
26554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26556         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
26557         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
26558         return tag_ptr(ret_conv, true);
26559 }
26560
26561 jboolean  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_is_ok"))) TS_CResult_InvoiceErrorDecodeErrorZ_is_ok(uint64_t o) {
26562         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
26563         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
26564         return ret_conv;
26565 }
26566
26567 void  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_free"))) TS_CResult_InvoiceErrorDecodeErrorZ_free(uint64_t _res) {
26568         if (!ptr_is_owned(_res)) return;
26569         void* _res_ptr = untag_ptr(_res);
26570         CHECK_ACCESS(_res_ptr);
26571         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
26572         FREE(untag_ptr(_res));
26573         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
26574 }
26575
26576 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
26577         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
26578         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
26579         return tag_ptr(ret_conv, true);
26580 }
26581 int64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone_ptr(uint64_t arg) {
26582         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
26583         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
26584         return ret_conv;
26585 }
26586
26587 uint64_t  __attribute__((export_name("TS_CResult_InvoiceErrorDecodeErrorZ_clone"))) TS_CResult_InvoiceErrorDecodeErrorZ_clone(uint64_t orig) {
26588         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
26589         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
26590         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
26591         return tag_ptr(ret_conv, true);
26592 }
26593
26594 uint64_t  __attribute__((export_name("TS_COption_FilterZ_some"))) TS_COption_FilterZ_some(uint64_t o) {
26595         void* o_ptr = untag_ptr(o);
26596         CHECK_ACCESS(o_ptr);
26597         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
26598         if (o_conv.free == LDKFilter_JCalls_free) {
26599                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26600                 LDKFilter_JCalls_cloned(&o_conv);
26601         }
26602         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
26603         *ret_copy = COption_FilterZ_some(o_conv);
26604         uint64_t ret_ref = tag_ptr(ret_copy, true);
26605         return ret_ref;
26606 }
26607
26608 uint64_t  __attribute__((export_name("TS_COption_FilterZ_none"))) TS_COption_FilterZ_none() {
26609         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
26610         *ret_copy = COption_FilterZ_none();
26611         uint64_t ret_ref = tag_ptr(ret_copy, true);
26612         return ret_ref;
26613 }
26614
26615 void  __attribute__((export_name("TS_COption_FilterZ_free"))) TS_COption_FilterZ_free(uint64_t _res) {
26616         if (!ptr_is_owned(_res)) return;
26617         void* _res_ptr = untag_ptr(_res);
26618         CHECK_ACCESS(_res_ptr);
26619         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
26620         FREE(untag_ptr(_res));
26621         COption_FilterZ_free(_res_conv);
26622 }
26623
26624 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_ok"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint64_t o) {
26625         LDKLockedChannelMonitor o_conv;
26626         o_conv.inner = untag_ptr(o);
26627         o_conv.is_owned = ptr_is_owned(o);
26628         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26629         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
26630         
26631         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
26632         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
26633         return tag_ptr(ret_conv, true);
26634 }
26635
26636 uint64_t  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_err"))) TS_CResult_LockedChannelMonitorNoneZ_err() {
26637         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
26638         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
26639         return tag_ptr(ret_conv, true);
26640 }
26641
26642 jboolean  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_is_ok"))) TS_CResult_LockedChannelMonitorNoneZ_is_ok(uint64_t o) {
26643         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
26644         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
26645         return ret_conv;
26646 }
26647
26648 void  __attribute__((export_name("TS_CResult_LockedChannelMonitorNoneZ_free"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint64_t _res) {
26649         if (!ptr_is_owned(_res)) return;
26650         void* _res_ptr = untag_ptr(_res);
26651         CHECK_ACCESS(_res_ptr);
26652         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
26653         FREE(untag_ptr(_res));
26654         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
26655 }
26656
26657 void  __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_free(uint64_tArray _res) {
26658         LDKCVec_OutPointZ _res_constr;
26659         _res_constr.datalen = _res->arr_len;
26660         if (_res_constr.datalen > 0)
26661                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements");
26662         else
26663                 _res_constr.data = NULL;
26664         uint64_t* _res_vals = _res->elems;
26665         for (size_t k = 0; k < _res_constr.datalen; k++) {
26666                 uint64_t _res_conv_10 = _res_vals[k];
26667                 LDKOutPoint _res_conv_10_conv;
26668                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
26669                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
26670                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
26671                 _res_constr.data[k] = _res_conv_10_conv;
26672         }
26673         FREE(_res);
26674         CVec_OutPointZ_free(_res_constr);
26675 }
26676
26677 void  __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) {
26678         LDKCVec_MonitorUpdateIdZ _res_constr;
26679         _res_constr.datalen = _res->arr_len;
26680         if (_res_constr.datalen > 0)
26681                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
26682         else
26683                 _res_constr.data = NULL;
26684         uint64_t* _res_vals = _res->elems;
26685         for (size_t r = 0; r < _res_constr.datalen; r++) {
26686                 uint64_t _res_conv_17 = _res_vals[r];
26687                 LDKMonitorUpdateId _res_conv_17_conv;
26688                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
26689                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
26690                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
26691                 _res_constr.data[r] = _res_conv_17_conv;
26692         }
26693         FREE(_res);
26694         CVec_MonitorUpdateIdZ_free(_res_constr);
26695 }
26696
26697 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
26698         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
26699         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
26700         return tag_ptr(ret_conv, true);
26701 }
26702 int64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) {
26703         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
26704         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
26705         return ret_conv;
26706 }
26707
26708 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) {
26709         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
26710         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
26711         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
26712         return tag_ptr(ret_conv, true);
26713 }
26714
26715 uint64_t  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) {
26716         LDKOutPoint a_conv;
26717         a_conv.inner = untag_ptr(a);
26718         a_conv.is_owned = ptr_is_owned(a);
26719         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26720         a_conv = OutPoint_clone(&a_conv);
26721         LDKCVec_MonitorUpdateIdZ b_constr;
26722         b_constr.datalen = b->arr_len;
26723         if (b_constr.datalen > 0)
26724                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
26725         else
26726                 b_constr.data = NULL;
26727         uint64_t* b_vals = b->elems;
26728         for (size_t r = 0; r < b_constr.datalen; r++) {
26729                 uint64_t b_conv_17 = b_vals[r];
26730                 LDKMonitorUpdateId b_conv_17_conv;
26731                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
26732                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
26733                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
26734                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
26735                 b_constr.data[r] = b_conv_17_conv;
26736         }
26737         FREE(b);
26738         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
26739         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
26740         return tag_ptr(ret_conv, true);
26741 }
26742
26743 void  __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) {
26744         if (!ptr_is_owned(_res)) return;
26745         void* _res_ptr = untag_ptr(_res);
26746         CHECK_ACCESS(_res_ptr);
26747         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
26748         FREE(untag_ptr(_res));
26749         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
26750 }
26751
26752 void  __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) {
26753         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
26754         _res_constr.datalen = _res->arr_len;
26755         if (_res_constr.datalen > 0)
26756                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
26757         else
26758                 _res_constr.data = NULL;
26759         uint64_t* _res_vals = _res->elems;
26760         for (size_t p = 0; p < _res_constr.datalen; p++) {
26761                 uint64_t _res_conv_41 = _res_vals[p];
26762                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
26763                 CHECK_ACCESS(_res_conv_41_ptr);
26764                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
26765                 FREE(untag_ptr(_res_conv_41));
26766                 _res_constr.data[p] = _res_conv_41_conv;
26767         }
26768         FREE(_res);
26769         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
26770 }
26771
26772 void  __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) {
26773         LDKCVec_PhantomRouteHintsZ _res_constr;
26774         _res_constr.datalen = _res->arr_len;
26775         if (_res_constr.datalen > 0)
26776                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
26777         else
26778                 _res_constr.data = NULL;
26779         uint64_t* _res_vals = _res->elems;
26780         for (size_t t = 0; t < _res_constr.datalen; t++) {
26781                 uint64_t _res_conv_19 = _res_vals[t];
26782                 LDKPhantomRouteHints _res_conv_19_conv;
26783                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
26784                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
26785                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
26786                 _res_constr.data[t] = _res_conv_19_conv;
26787         }
26788         FREE(_res);
26789         CVec_PhantomRouteHintsZ_free(_res_constr);
26790 }
26791
26792 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(uint64_t o) {
26793         LDKBolt11Invoice o_conv;
26794         o_conv.inner = untag_ptr(o);
26795         o_conv.is_owned = ptr_is_owned(o);
26796         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26797         o_conv = Bolt11Invoice_clone(&o_conv);
26798         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26799         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
26800         return tag_ptr(ret_conv, true);
26801 }
26802
26803 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_err(uint64_t e) {
26804         void* e_ptr = untag_ptr(e);
26805         CHECK_ACCESS(e_ptr);
26806         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
26807         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
26808         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26809         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
26810         return tag_ptr(ret_conv, true);
26811 }
26812
26813 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(uint64_t o) {
26814         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
26815         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
26816         return ret_conv;
26817 }
26818
26819 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_free(uint64_t _res) {
26820         if (!ptr_is_owned(_res)) return;
26821         void* _res_ptr = untag_ptr(_res);
26822         CHECK_ACCESS(_res_ptr);
26823         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
26824         FREE(untag_ptr(_res));
26825         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
26826 }
26827
26828 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
26829         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26830         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
26831         return tag_ptr(ret_conv, true);
26832 }
26833 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(uint64_t arg) {
26834         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
26835         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
26836         return ret_conv;
26837 }
26838
26839 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone"))) TS_CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(uint64_t orig) {
26840         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
26841         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
26842         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
26843         return tag_ptr(ret_conv, true);
26844 }
26845
26846 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_ok(uint32_t o) {
26847         LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
26848         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
26849         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
26850         return tag_ptr(ret_conv, true);
26851 }
26852
26853 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_err"))) TS_CResult_SiPrefixBolt11ParseErrorZ_err(uint64_t e) {
26854         void* e_ptr = untag_ptr(e);
26855         CHECK_ACCESS(e_ptr);
26856         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
26857         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
26858         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
26859         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
26860         return tag_ptr(ret_conv, true);
26861 }
26862
26863 jboolean  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok"))) TS_CResult_SiPrefixBolt11ParseErrorZ_is_ok(uint64_t o) {
26864         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
26865         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
26866         return ret_conv;
26867 }
26868
26869 void  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_free"))) TS_CResult_SiPrefixBolt11ParseErrorZ_free(uint64_t _res) {
26870         if (!ptr_is_owned(_res)) return;
26871         void* _res_ptr = untag_ptr(_res);
26872         CHECK_ACCESS(_res_ptr);
26873         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
26874         FREE(untag_ptr(_res));
26875         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
26876 }
26877
26878 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
26879         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
26880         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
26881         return tag_ptr(ret_conv, true);
26882 }
26883 int64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
26884         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
26885         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
26886         return ret_conv;
26887 }
26888
26889 uint64_t  __attribute__((export_name("TS_CResult_SiPrefixBolt11ParseErrorZ_clone"))) TS_CResult_SiPrefixBolt11ParseErrorZ_clone(uint64_t orig) {
26890         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
26891         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
26892         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
26893         return tag_ptr(ret_conv, true);
26894 }
26895
26896 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(uint64_t o) {
26897         LDKBolt11Invoice o_conv;
26898         o_conv.inner = untag_ptr(o);
26899         o_conv.is_owned = ptr_is_owned(o);
26900         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26901         o_conv = Bolt11Invoice_clone(&o_conv);
26902         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
26903         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
26904         return tag_ptr(ret_conv, true);
26905 }
26906
26907 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(uint64_t e) {
26908         void* e_ptr = untag_ptr(e);
26909         CHECK_ACCESS(e_ptr);
26910         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
26911         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
26912         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
26913         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
26914         return tag_ptr(ret_conv, true);
26915 }
26916
26917 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) {
26918         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
26919         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
26920         return ret_conv;
26921 }
26922
26923 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(uint64_t _res) {
26924         if (!ptr_is_owned(_res)) return;
26925         void* _res_ptr = untag_ptr(_res);
26926         CHECK_ACCESS(_res_ptr);
26927         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
26928         FREE(untag_ptr(_res));
26929         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
26930 }
26931
26932 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
26933         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
26934         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
26935         return tag_ptr(ret_conv, true);
26936 }
26937 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) {
26938         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
26939         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
26940         return ret_conv;
26941 }
26942
26943 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) {
26944         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
26945         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
26946         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
26947         return tag_ptr(ret_conv, true);
26948 }
26949
26950 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(uint64_t o) {
26951         LDKSignedRawBolt11Invoice o_conv;
26952         o_conv.inner = untag_ptr(o);
26953         o_conv.is_owned = ptr_is_owned(o);
26954         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26955         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
26956         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
26957         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
26958         return tag_ptr(ret_conv, true);
26959 }
26960
26961 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(uint64_t e) {
26962         void* e_ptr = untag_ptr(e);
26963         CHECK_ACCESS(e_ptr);
26964         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
26965         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
26966         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
26967         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
26968         return tag_ptr(ret_conv, true);
26969 }
26970
26971 jboolean  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(uint64_t o) {
26972         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
26973         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
26974         return ret_conv;
26975 }
26976
26977 void  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(uint64_t _res) {
26978         if (!ptr_is_owned(_res)) return;
26979         void* _res_ptr = untag_ptr(_res);
26980         CHECK_ACCESS(_res_ptr);
26981         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
26982         FREE(untag_ptr(_res));
26983         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
26984 }
26985
26986 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
26987         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
26988         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
26989         return tag_ptr(ret_conv, true);
26990 }
26991 int64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(uint64_t arg) {
26992         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
26993         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
26994         return ret_conv;
26995 }
26996
26997 uint64_t  __attribute__((export_name("TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone"))) TS_CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(uint64_t orig) {
26998         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
26999         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
27000         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
27001         return tag_ptr(ret_conv, true);
27002 }
27003
27004 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
27005         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27006         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
27007         return tag_ptr(ret_conv, true);
27008 }
27009 int64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(uint64_t arg) {
27010         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
27011         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
27012         return ret_conv;
27013 }
27014
27015 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(uint64_t orig) {
27016         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
27017         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27018         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
27019         return tag_ptr(ret_conv, true);
27020 }
27021
27022 uint64_t  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) {
27023         LDKRawBolt11Invoice a_conv;
27024         a_conv.inner = untag_ptr(a);
27025         a_conv.is_owned = ptr_is_owned(a);
27026         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27027         a_conv = RawBolt11Invoice_clone(&a_conv);
27028         LDKThirtyTwoBytes b_ref;
27029         CHECK(b->arr_len == 32);
27030         memcpy(b_ref.data, b->elems, 32); FREE(b);
27031         LDKBolt11InvoiceSignature c_conv;
27032         c_conv.inner = untag_ptr(c);
27033         c_conv.is_owned = ptr_is_owned(c);
27034         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
27035         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
27036         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
27037         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
27038         return tag_ptr(ret_conv, true);
27039 }
27040
27041 void  __attribute__((export_name("TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free"))) TS_C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(uint64_t _res) {
27042         if (!ptr_is_owned(_res)) return;
27043         void* _res_ptr = untag_ptr(_res);
27044         CHECK_ACCESS(_res_ptr);
27045         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
27046         FREE(untag_ptr(_res));
27047         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
27048 }
27049
27050 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) {
27051         LDKPayeePubKey o_conv;
27052         o_conv.inner = untag_ptr(o);
27053         o_conv.is_owned = ptr_is_owned(o);
27054         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27055         o_conv = PayeePubKey_clone(&o_conv);
27056         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27057         *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
27058         return tag_ptr(ret_conv, true);
27059 }
27060
27061 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) {
27062         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e);
27063         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27064         *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
27065         return tag_ptr(ret_conv, true);
27066 }
27067
27068 jboolean  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) {
27069         LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o);
27070         jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv);
27071         return ret_conv;
27072 }
27073
27074 void  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) {
27075         if (!ptr_is_owned(_res)) return;
27076         void* _res_ptr = untag_ptr(_res);
27077         CHECK_ACCESS(_res_ptr);
27078         LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr);
27079         FREE(untag_ptr(_res));
27080         CResult_PayeePubKeyErrorZ_free(_res_conv);
27081 }
27082
27083 static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) {
27084         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27085         *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg);
27086         return tag_ptr(ret_conv, true);
27087 }
27088 int64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) {
27089         LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg);
27090         int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv);
27091         return ret_conv;
27092 }
27093
27094 uint64_t  __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) {
27095         LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig);
27096         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
27097         *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
27098         return tag_ptr(ret_conv, true);
27099 }
27100
27101 void  __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) {
27102         LDKCVec_PrivateRouteZ _res_constr;
27103         _res_constr.datalen = _res->arr_len;
27104         if (_res_constr.datalen > 0)
27105                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
27106         else
27107                 _res_constr.data = NULL;
27108         uint64_t* _res_vals = _res->elems;
27109         for (size_t o = 0; o < _res_constr.datalen; o++) {
27110                 uint64_t _res_conv_14 = _res_vals[o];
27111                 LDKPrivateRoute _res_conv_14_conv;
27112                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
27113                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
27114                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
27115                 _res_constr.data[o] = _res_conv_14_conv;
27116         }
27117         FREE(_res);
27118         CVec_PrivateRouteZ_free(_res_constr);
27119 }
27120
27121 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) {
27122         LDKPositiveTimestamp o_conv;
27123         o_conv.inner = untag_ptr(o);
27124         o_conv.is_owned = ptr_is_owned(o);
27125         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27126         o_conv = PositiveTimestamp_clone(&o_conv);
27127         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27128         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
27129         return tag_ptr(ret_conv, true);
27130 }
27131
27132 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) {
27133         LDKCreationError e_conv = LDKCreationError_from_js(e);
27134         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27135         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
27136         return tag_ptr(ret_conv, true);
27137 }
27138
27139 jboolean  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) {
27140         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
27141         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
27142         return ret_conv;
27143 }
27144
27145 void  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) {
27146         if (!ptr_is_owned(_res)) return;
27147         void* _res_ptr = untag_ptr(_res);
27148         CHECK_ACCESS(_res_ptr);
27149         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
27150         FREE(untag_ptr(_res));
27151         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
27152 }
27153
27154 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
27155         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27156         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
27157         return tag_ptr(ret_conv, true);
27158 }
27159 int64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) {
27160         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
27161         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
27162         return ret_conv;
27163 }
27164
27165 uint64_t  __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) {
27166         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
27167         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
27168         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
27169         return tag_ptr(ret_conv, true);
27170 }
27171
27172 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_ok() {
27173         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27174         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
27175         return tag_ptr(ret_conv, true);
27176 }
27177
27178 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_err"))) TS_CResult_NoneBolt11SemanticErrorZ_err(uint32_t e) {
27179         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27180         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27181         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
27182         return tag_ptr(ret_conv, true);
27183 }
27184
27185 jboolean  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_is_ok"))) TS_CResult_NoneBolt11SemanticErrorZ_is_ok(uint64_t o) {
27186         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
27187         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
27188         return ret_conv;
27189 }
27190
27191 void  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_free"))) TS_CResult_NoneBolt11SemanticErrorZ_free(uint64_t _res) {
27192         if (!ptr_is_owned(_res)) return;
27193         void* _res_ptr = untag_ptr(_res);
27194         CHECK_ACCESS(_res_ptr);
27195         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
27196         FREE(untag_ptr(_res));
27197         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
27198 }
27199
27200 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
27201         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27202         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
27203         return tag_ptr(ret_conv, true);
27204 }
27205 int64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_NoneBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
27206         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
27207         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
27208         return ret_conv;
27209 }
27210
27211 uint64_t  __attribute__((export_name("TS_CResult_NoneBolt11SemanticErrorZ_clone"))) TS_CResult_NoneBolt11SemanticErrorZ_clone(uint64_t orig) {
27212         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
27213         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
27214         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
27215         return tag_ptr(ret_conv, true);
27216 }
27217
27218 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(uint64_t o) {
27219         LDKBolt11Invoice o_conv;
27220         o_conv.inner = untag_ptr(o);
27221         o_conv.is_owned = ptr_is_owned(o);
27222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27223         o_conv = Bolt11Invoice_clone(&o_conv);
27224         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27225         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
27226         return tag_ptr(ret_conv, true);
27227 }
27228
27229 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(uint32_t e) {
27230         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_js(e);
27231         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27232         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
27233         return tag_ptr(ret_conv, true);
27234 }
27235
27236 jboolean  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(uint64_t o) {
27237         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
27238         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
27239         return ret_conv;
27240 }
27241
27242 void  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(uint64_t _res) {
27243         if (!ptr_is_owned(_res)) return;
27244         void* _res_ptr = untag_ptr(_res);
27245         CHECK_ACCESS(_res_ptr);
27246         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
27247         FREE(untag_ptr(_res));
27248         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
27249 }
27250
27251 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
27252         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27253         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
27254         return tag_ptr(ret_conv, true);
27255 }
27256 int64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(uint64_t arg) {
27257         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
27258         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
27259         return ret_conv;
27260 }
27261
27262 uint64_t  __attribute__((export_name("TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone"))) TS_CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(uint64_t orig) {
27263         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
27264         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
27265         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
27266         return tag_ptr(ret_conv, true);
27267 }
27268
27269 void  __attribute__((export_name("TS_CVec_AddressZ_free"))) TS_CVec_AddressZ_free(ptrArray _res) {
27270         LDKCVec_AddressZ _res_constr;
27271         _res_constr.datalen = _res->arr_len;
27272         if (_res_constr.datalen > 0)
27273                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_AddressZ Elements");
27274         else
27275                 _res_constr.data = NULL;
27276         jstring* _res_vals = (void*) _res->elems;
27277         for (size_t i = 0; i < _res_constr.datalen; i++) {
27278                 jstring _res_conv_8 = _res_vals[i];
27279                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
27280                 _res_constr.data[i] = dummy;
27281         }
27282         FREE(_res);
27283         CVec_AddressZ_free(_res_constr);
27284 }
27285
27286 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) {
27287         LDKDescription o_conv;
27288         o_conv.inner = untag_ptr(o);
27289         o_conv.is_owned = ptr_is_owned(o);
27290         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27291         o_conv = Description_clone(&o_conv);
27292         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27293         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
27294         return tag_ptr(ret_conv, true);
27295 }
27296
27297 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) {
27298         LDKCreationError e_conv = LDKCreationError_from_js(e);
27299         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27300         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
27301         return tag_ptr(ret_conv, true);
27302 }
27303
27304 jboolean  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) {
27305         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
27306         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
27307         return ret_conv;
27308 }
27309
27310 void  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) {
27311         if (!ptr_is_owned(_res)) return;
27312         void* _res_ptr = untag_ptr(_res);
27313         CHECK_ACCESS(_res_ptr);
27314         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
27315         FREE(untag_ptr(_res));
27316         CResult_DescriptionCreationErrorZ_free(_res_conv);
27317 }
27318
27319 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
27320         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27321         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
27322         return tag_ptr(ret_conv, true);
27323 }
27324 int64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) {
27325         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
27326         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
27327         return ret_conv;
27328 }
27329
27330 uint64_t  __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) {
27331         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
27332         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
27333         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
27334         return tag_ptr(ret_conv, true);
27335 }
27336
27337 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) {
27338         LDKPrivateRoute o_conv;
27339         o_conv.inner = untag_ptr(o);
27340         o_conv.is_owned = ptr_is_owned(o);
27341         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27342         o_conv = PrivateRoute_clone(&o_conv);
27343         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27344         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
27345         return tag_ptr(ret_conv, true);
27346 }
27347
27348 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) {
27349         LDKCreationError e_conv = LDKCreationError_from_js(e);
27350         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27351         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
27352         return tag_ptr(ret_conv, true);
27353 }
27354
27355 jboolean  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) {
27356         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
27357         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
27358         return ret_conv;
27359 }
27360
27361 void  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) {
27362         if (!ptr_is_owned(_res)) return;
27363         void* _res_ptr = untag_ptr(_res);
27364         CHECK_ACCESS(_res_ptr);
27365         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
27366         FREE(untag_ptr(_res));
27367         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
27368 }
27369
27370 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
27371         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27372         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
27373         return tag_ptr(ret_conv, true);
27374 }
27375 int64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) {
27376         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
27377         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
27378         return ret_conv;
27379 }
27380
27381 uint64_t  __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) {
27382         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
27383         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
27384         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
27385         return tag_ptr(ret_conv, true);
27386 }
27387
27388 void  __attribute__((export_name("TS_APIError_free"))) TS_APIError_free(uint64_t this_ptr) {
27389         if (!ptr_is_owned(this_ptr)) return;
27390         void* this_ptr_ptr = untag_ptr(this_ptr);
27391         CHECK_ACCESS(this_ptr_ptr);
27392         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
27393         FREE(untag_ptr(this_ptr));
27394         APIError_free(this_ptr_conv);
27395 }
27396
27397 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
27398         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27399         *ret_copy = APIError_clone(arg);
27400         uint64_t ret_ref = tag_ptr(ret_copy, true);
27401         return ret_ref;
27402 }
27403 int64_t  __attribute__((export_name("TS_APIError_clone_ptr"))) TS_APIError_clone_ptr(uint64_t arg) {
27404         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
27405         int64_t ret_conv = APIError_clone_ptr(arg_conv);
27406         return ret_conv;
27407 }
27408
27409 uint64_t  __attribute__((export_name("TS_APIError_clone"))) TS_APIError_clone(uint64_t orig) {
27410         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
27411         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27412         *ret_copy = APIError_clone(orig_conv);
27413         uint64_t ret_ref = tag_ptr(ret_copy, true);
27414         return ret_ref;
27415 }
27416
27417 uint64_t  __attribute__((export_name("TS_APIError_apimisuse_error"))) TS_APIError_apimisuse_error(jstring err) {
27418         LDKStr err_conv = str_ref_to_owned_c(err);
27419         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27420         *ret_copy = APIError_apimisuse_error(err_conv);
27421         uint64_t ret_ref = tag_ptr(ret_copy, true);
27422         return ret_ref;
27423 }
27424
27425 uint64_t  __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIError_fee_rate_too_high(jstring err, int32_t feerate) {
27426         LDKStr err_conv = str_ref_to_owned_c(err);
27427         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27428         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
27429         uint64_t ret_ref = tag_ptr(ret_copy, true);
27430         return ret_ref;
27431 }
27432
27433 uint64_t  __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) {
27434         LDKStr err_conv = str_ref_to_owned_c(err);
27435         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27436         *ret_copy = APIError_invalid_route(err_conv);
27437         uint64_t ret_ref = tag_ptr(ret_copy, true);
27438         return ret_ref;
27439 }
27440
27441 uint64_t  __attribute__((export_name("TS_APIError_channel_unavailable"))) TS_APIError_channel_unavailable(jstring err) {
27442         LDKStr err_conv = str_ref_to_owned_c(err);
27443         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27444         *ret_copy = APIError_channel_unavailable(err_conv);
27445         uint64_t ret_ref = tag_ptr(ret_copy, true);
27446         return ret_ref;
27447 }
27448
27449 uint64_t  __attribute__((export_name("TS_APIError_monitor_update_in_progress"))) TS_APIError_monitor_update_in_progress() {
27450         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27451         *ret_copy = APIError_monitor_update_in_progress();
27452         uint64_t ret_ref = tag_ptr(ret_copy, true);
27453         return ret_ref;
27454 }
27455
27456 uint64_t  __attribute__((export_name("TS_APIError_incompatible_shutdown_script"))) TS_APIError_incompatible_shutdown_script(uint64_t script) {
27457         LDKShutdownScript script_conv;
27458         script_conv.inner = untag_ptr(script);
27459         script_conv.is_owned = ptr_is_owned(script);
27460         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
27461         script_conv = ShutdownScript_clone(&script_conv);
27462         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
27463         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
27464         uint64_t ret_ref = tag_ptr(ret_copy, true);
27465         return ret_ref;
27466 }
27467
27468 jboolean  __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t a, uint64_t b) {
27469         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
27470         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
27471         jboolean ret_conv = APIError_eq(a_conv, b_conv);
27472         return ret_conv;
27473 }
27474
27475 int8_tArray  __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) {
27476         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
27477         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
27478         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27479         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27480         CVec_u8Z_free(ret_var);
27481         return ret_arr;
27482 }
27483
27484 uint64_t  __attribute__((export_name("TS_APIError_read"))) TS_APIError_read(int8_tArray ser) {
27485         LDKu8slice ser_ref;
27486         ser_ref.datalen = ser->arr_len;
27487         ser_ref.data = ser->elems;
27488         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
27489         *ret_conv = APIError_read(ser_ref);
27490         FREE(ser);
27491         return tag_ptr(ret_conv, true);
27492 }
27493
27494 void  __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) {
27495         LDKBigSize this_obj_conv;
27496         this_obj_conv.inner = untag_ptr(this_obj);
27497         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27499         BigSize_free(this_obj_conv);
27500 }
27501
27502 int64_t  __attribute__((export_name("TS_BigSize_get_a"))) TS_BigSize_get_a(uint64_t this_ptr) {
27503         LDKBigSize this_ptr_conv;
27504         this_ptr_conv.inner = untag_ptr(this_ptr);
27505         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27507         this_ptr_conv.is_owned = false;
27508         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
27509         return ret_conv;
27510 }
27511
27512 void  __attribute__((export_name("TS_BigSize_set_a"))) TS_BigSize_set_a(uint64_t this_ptr, int64_t val) {
27513         LDKBigSize this_ptr_conv;
27514         this_ptr_conv.inner = untag_ptr(this_ptr);
27515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27517         this_ptr_conv.is_owned = false;
27518         BigSize_set_a(&this_ptr_conv, val);
27519 }
27520
27521 uint64_t  __attribute__((export_name("TS_BigSize_new"))) TS_BigSize_new(int64_t a_arg) {
27522         LDKBigSize ret_var = BigSize_new(a_arg);
27523         uint64_t ret_ref = 0;
27524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27526         return ret_ref;
27527 }
27528
27529 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
27530         LDKBigSize ret_var = BigSize_clone(arg);
27531         uint64_t ret_ref = 0;
27532         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27533         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27534         return ret_ref;
27535 }
27536 int64_t  __attribute__((export_name("TS_BigSize_clone_ptr"))) TS_BigSize_clone_ptr(uint64_t arg) {
27537         LDKBigSize arg_conv;
27538         arg_conv.inner = untag_ptr(arg);
27539         arg_conv.is_owned = ptr_is_owned(arg);
27540         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27541         arg_conv.is_owned = false;
27542         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
27543         return ret_conv;
27544 }
27545
27546 uint64_t  __attribute__((export_name("TS_BigSize_clone"))) TS_BigSize_clone(uint64_t orig) {
27547         LDKBigSize orig_conv;
27548         orig_conv.inner = untag_ptr(orig);
27549         orig_conv.is_owned = ptr_is_owned(orig);
27550         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27551         orig_conv.is_owned = false;
27552         LDKBigSize ret_var = BigSize_clone(&orig_conv);
27553         uint64_t ret_ref = 0;
27554         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27555         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27556         return ret_ref;
27557 }
27558
27559 int64_t  __attribute__((export_name("TS_BigSize_hash"))) TS_BigSize_hash(uint64_t o) {
27560         LDKBigSize o_conv;
27561         o_conv.inner = untag_ptr(o);
27562         o_conv.is_owned = ptr_is_owned(o);
27563         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27564         o_conv.is_owned = false;
27565         int64_t ret_conv = BigSize_hash(&o_conv);
27566         return ret_conv;
27567 }
27568
27569 jboolean  __attribute__((export_name("TS_BigSize_eq"))) TS_BigSize_eq(uint64_t a, uint64_t b) {
27570         LDKBigSize a_conv;
27571         a_conv.inner = untag_ptr(a);
27572         a_conv.is_owned = ptr_is_owned(a);
27573         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27574         a_conv.is_owned = false;
27575         LDKBigSize b_conv;
27576         b_conv.inner = untag_ptr(b);
27577         b_conv.is_owned = ptr_is_owned(b);
27578         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27579         b_conv.is_owned = false;
27580         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
27581         return ret_conv;
27582 }
27583
27584 int8_tArray  __attribute__((export_name("TS_BigSize_write"))) TS_BigSize_write(uint64_t obj) {
27585         LDKBigSize obj_conv;
27586         obj_conv.inner = untag_ptr(obj);
27587         obj_conv.is_owned = ptr_is_owned(obj);
27588         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27589         obj_conv.is_owned = false;
27590         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
27591         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27592         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27593         CVec_u8Z_free(ret_var);
27594         return ret_arr;
27595 }
27596
27597 uint64_t  __attribute__((export_name("TS_BigSize_read"))) TS_BigSize_read(int8_tArray ser) {
27598         LDKu8slice ser_ref;
27599         ser_ref.datalen = ser->arr_len;
27600         ser_ref.data = ser->elems;
27601         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
27602         *ret_conv = BigSize_read(ser_ref);
27603         FREE(ser);
27604         return tag_ptr(ret_conv, true);
27605 }
27606
27607 void  __attribute__((export_name("TS_Hostname_free"))) TS_Hostname_free(uint64_t this_obj) {
27608         LDKHostname this_obj_conv;
27609         this_obj_conv.inner = untag_ptr(this_obj);
27610         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27612         Hostname_free(this_obj_conv);
27613 }
27614
27615 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
27616         LDKHostname ret_var = Hostname_clone(arg);
27617         uint64_t ret_ref = 0;
27618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27620         return ret_ref;
27621 }
27622 int64_t  __attribute__((export_name("TS_Hostname_clone_ptr"))) TS_Hostname_clone_ptr(uint64_t arg) {
27623         LDKHostname arg_conv;
27624         arg_conv.inner = untag_ptr(arg);
27625         arg_conv.is_owned = ptr_is_owned(arg);
27626         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27627         arg_conv.is_owned = false;
27628         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
27629         return ret_conv;
27630 }
27631
27632 uint64_t  __attribute__((export_name("TS_Hostname_clone"))) TS_Hostname_clone(uint64_t orig) {
27633         LDKHostname orig_conv;
27634         orig_conv.inner = untag_ptr(orig);
27635         orig_conv.is_owned = ptr_is_owned(orig);
27636         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27637         orig_conv.is_owned = false;
27638         LDKHostname ret_var = Hostname_clone(&orig_conv);
27639         uint64_t ret_ref = 0;
27640         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27641         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27642         return ret_ref;
27643 }
27644
27645 jboolean  __attribute__((export_name("TS_Hostname_eq"))) TS_Hostname_eq(uint64_t a, uint64_t b) {
27646         LDKHostname a_conv;
27647         a_conv.inner = untag_ptr(a);
27648         a_conv.is_owned = ptr_is_owned(a);
27649         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27650         a_conv.is_owned = false;
27651         LDKHostname b_conv;
27652         b_conv.inner = untag_ptr(b);
27653         b_conv.is_owned = ptr_is_owned(b);
27654         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27655         b_conv.is_owned = false;
27656         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
27657         return ret_conv;
27658 }
27659
27660 int8_t  __attribute__((export_name("TS_Hostname_len"))) TS_Hostname_len(uint64_t this_arg) {
27661         LDKHostname this_arg_conv;
27662         this_arg_conv.inner = untag_ptr(this_arg);
27663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27665         this_arg_conv.is_owned = false;
27666         int8_t ret_conv = Hostname_len(&this_arg_conv);
27667         return ret_conv;
27668 }
27669
27670 int8_tArray  __attribute__((export_name("TS_Hostname_write"))) TS_Hostname_write(uint64_t obj) {
27671         LDKHostname obj_conv;
27672         obj_conv.inner = untag_ptr(obj);
27673         obj_conv.is_owned = ptr_is_owned(obj);
27674         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27675         obj_conv.is_owned = false;
27676         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
27677         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27678         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27679         CVec_u8Z_free(ret_var);
27680         return ret_arr;
27681 }
27682
27683 uint64_t  __attribute__((export_name("TS_Hostname_read"))) TS_Hostname_read(int8_tArray ser) {
27684         LDKu8slice ser_ref;
27685         ser_ref.datalen = ser->arr_len;
27686         ser_ref.data = ser->elems;
27687         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
27688         *ret_conv = Hostname_read(ser_ref);
27689         FREE(ser);
27690         return tag_ptr(ret_conv, true);
27691 }
27692
27693 void  __attribute__((export_name("TS_TransactionU16LenLimited_free"))) TS_TransactionU16LenLimited_free(uint64_t this_obj) {
27694         LDKTransactionU16LenLimited this_obj_conv;
27695         this_obj_conv.inner = untag_ptr(this_obj);
27696         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27698         TransactionU16LenLimited_free(this_obj_conv);
27699 }
27700
27701 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
27702         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
27703         uint64_t ret_ref = 0;
27704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27706         return ret_ref;
27707 }
27708 int64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone_ptr"))) TS_TransactionU16LenLimited_clone_ptr(uint64_t arg) {
27709         LDKTransactionU16LenLimited arg_conv;
27710         arg_conv.inner = untag_ptr(arg);
27711         arg_conv.is_owned = ptr_is_owned(arg);
27712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27713         arg_conv.is_owned = false;
27714         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
27715         return ret_conv;
27716 }
27717
27718 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_clone"))) TS_TransactionU16LenLimited_clone(uint64_t orig) {
27719         LDKTransactionU16LenLimited orig_conv;
27720         orig_conv.inner = untag_ptr(orig);
27721         orig_conv.is_owned = ptr_is_owned(orig);
27722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27723         orig_conv.is_owned = false;
27724         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
27725         uint64_t ret_ref = 0;
27726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27728         return ret_ref;
27729 }
27730
27731 jboolean  __attribute__((export_name("TS_TransactionU16LenLimited_eq"))) TS_TransactionU16LenLimited_eq(uint64_t a, uint64_t b) {
27732         LDKTransactionU16LenLimited a_conv;
27733         a_conv.inner = untag_ptr(a);
27734         a_conv.is_owned = ptr_is_owned(a);
27735         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27736         a_conv.is_owned = false;
27737         LDKTransactionU16LenLimited b_conv;
27738         b_conv.inner = untag_ptr(b);
27739         b_conv.is_owned = ptr_is_owned(b);
27740         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27741         b_conv.is_owned = false;
27742         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
27743         return ret_conv;
27744 }
27745
27746 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_new"))) TS_TransactionU16LenLimited_new(int8_tArray transaction) {
27747         LDKTransaction transaction_ref;
27748         transaction_ref.datalen = transaction->arr_len;
27749         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
27750         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
27751         transaction_ref.data_is_owned = true;
27752         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
27753         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
27754         return tag_ptr(ret_conv, true);
27755 }
27756
27757 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_into_transaction"))) TS_TransactionU16LenLimited_into_transaction(uint64_t this_arg) {
27758         LDKTransactionU16LenLimited this_arg_conv;
27759         this_arg_conv.inner = untag_ptr(this_arg);
27760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
27761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
27762         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
27763         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
27764         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27765         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27766         Transaction_free(ret_var);
27767         return ret_arr;
27768 }
27769
27770 int8_tArray  __attribute__((export_name("TS_TransactionU16LenLimited_write"))) TS_TransactionU16LenLimited_write(uint64_t obj) {
27771         LDKTransactionU16LenLimited obj_conv;
27772         obj_conv.inner = untag_ptr(obj);
27773         obj_conv.is_owned = ptr_is_owned(obj);
27774         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27775         obj_conv.is_owned = false;
27776         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
27777         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27778         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27779         CVec_u8Z_free(ret_var);
27780         return ret_arr;
27781 }
27782
27783 uint64_t  __attribute__((export_name("TS_TransactionU16LenLimited_read"))) TS_TransactionU16LenLimited_read(int8_tArray ser) {
27784         LDKu8slice ser_ref;
27785         ser_ref.datalen = ser->arr_len;
27786         ser_ref.data = ser->elems;
27787         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
27788         *ret_conv = TransactionU16LenLimited_read(ser_ref);
27789         FREE(ser);
27790         return tag_ptr(ret_conv, true);
27791 }
27792
27793 uint64_t  __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_tArray sk) {
27794         LDKu8slice msg_ref;
27795         msg_ref.datalen = msg->arr_len;
27796         msg_ref.data = msg->elems;
27797         uint8_t sk_arr[32];
27798         CHECK(sk->arr_len == 32);
27799         memcpy(sk_arr, sk->elems, 32); FREE(sk);
27800         uint8_t (*sk_ref)[32] = &sk_arr;
27801         LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
27802         *ret_conv = sign(msg_ref, sk_ref);
27803         FREE(msg);
27804         return tag_ptr(ret_conv, true);
27805 }
27806
27807 uint64_t  __attribute__((export_name("TS_recover_pk"))) TS_recover_pk(int8_tArray msg, jstring sig) {
27808         LDKu8slice msg_ref;
27809         msg_ref.datalen = msg->arr_len;
27810         msg_ref.data = msg->elems;
27811         LDKStr sig_conv = str_ref_to_owned_c(sig);
27812         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
27813         *ret_conv = recover_pk(msg_ref, sig_conv);
27814         FREE(msg);
27815         return tag_ptr(ret_conv, true);
27816 }
27817
27818 jboolean  __attribute__((export_name("TS_verify"))) TS_verify(int8_tArray msg, jstring sig, int8_tArray pk) {
27819         LDKu8slice msg_ref;
27820         msg_ref.datalen = msg->arr_len;
27821         msg_ref.data = msg->elems;
27822         LDKStr sig_conv = str_ref_to_owned_c(sig);
27823         LDKPublicKey pk_ref;
27824         CHECK(pk->arr_len == 33);
27825         memcpy(pk_ref.compressed_form, pk->elems, 33); FREE(pk);
27826         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
27827         FREE(msg);
27828         return ret_conv;
27829 }
27830
27831 int8_tArray  __attribute__((export_name("TS_construct_invoice_preimage"))) TS_construct_invoice_preimage(int8_tArray hrp_bytes, ptrArray data_without_signature) {
27832         LDKu8slice hrp_bytes_ref;
27833         hrp_bytes_ref.datalen = hrp_bytes->arr_len;
27834         hrp_bytes_ref.data = hrp_bytes->elems;
27835         LDKCVec_U5Z data_without_signature_constr;
27836         data_without_signature_constr.datalen = data_without_signature->arr_len;
27837         if (data_without_signature_constr.datalen > 0)
27838                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
27839         else
27840                 data_without_signature_constr.data = NULL;
27841         int8_t* data_without_signature_vals = (void*) data_without_signature->elems;
27842         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
27843                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
27844                 
27845                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
27846         }
27847         FREE(data_without_signature);
27848         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
27849         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27850         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27851         CVec_u8Z_free(ret_var);
27852         FREE(hrp_bytes);
27853         return ret_arr;
27854 }
27855
27856 void  __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64_t this_ptr) {
27857         if (!ptr_is_owned(this_ptr)) return;
27858         void* this_ptr_ptr = untag_ptr(this_ptr);
27859         CHECK_ACCESS(this_ptr_ptr);
27860         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
27861         FREE(untag_ptr(this_ptr));
27862         Persister_free(this_ptr_conv);
27863 }
27864
27865 void  __attribute__((export_name("TS_UntrustedString_free"))) TS_UntrustedString_free(uint64_t this_obj) {
27866         LDKUntrustedString this_obj_conv;
27867         this_obj_conv.inner = untag_ptr(this_obj);
27868         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27869         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27870         UntrustedString_free(this_obj_conv);
27871 }
27872
27873 jstring  __attribute__((export_name("TS_UntrustedString_get_a"))) TS_UntrustedString_get_a(uint64_t this_ptr) {
27874         LDKUntrustedString this_ptr_conv;
27875         this_ptr_conv.inner = untag_ptr(this_ptr);
27876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27878         this_ptr_conv.is_owned = false;
27879         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
27880         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27881         Str_free(ret_str);
27882         return ret_conv;
27883 }
27884
27885 void  __attribute__((export_name("TS_UntrustedString_set_a"))) TS_UntrustedString_set_a(uint64_t this_ptr, jstring val) {
27886         LDKUntrustedString this_ptr_conv;
27887         this_ptr_conv.inner = untag_ptr(this_ptr);
27888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27890         this_ptr_conv.is_owned = false;
27891         LDKStr val_conv = str_ref_to_owned_c(val);
27892         UntrustedString_set_a(&this_ptr_conv, val_conv);
27893 }
27894
27895 uint64_t  __attribute__((export_name("TS_UntrustedString_new"))) TS_UntrustedString_new(jstring a_arg) {
27896         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
27897         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
27898         uint64_t ret_ref = 0;
27899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27901         return ret_ref;
27902 }
27903
27904 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
27905         LDKUntrustedString ret_var = UntrustedString_clone(arg);
27906         uint64_t ret_ref = 0;
27907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27909         return ret_ref;
27910 }
27911 int64_t  __attribute__((export_name("TS_UntrustedString_clone_ptr"))) TS_UntrustedString_clone_ptr(uint64_t arg) {
27912         LDKUntrustedString arg_conv;
27913         arg_conv.inner = untag_ptr(arg);
27914         arg_conv.is_owned = ptr_is_owned(arg);
27915         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
27916         arg_conv.is_owned = false;
27917         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
27918         return ret_conv;
27919 }
27920
27921 uint64_t  __attribute__((export_name("TS_UntrustedString_clone"))) TS_UntrustedString_clone(uint64_t orig) {
27922         LDKUntrustedString orig_conv;
27923         orig_conv.inner = untag_ptr(orig);
27924         orig_conv.is_owned = ptr_is_owned(orig);
27925         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
27926         orig_conv.is_owned = false;
27927         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
27928         uint64_t ret_ref = 0;
27929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
27930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
27931         return ret_ref;
27932 }
27933
27934 jboolean  __attribute__((export_name("TS_UntrustedString_eq"))) TS_UntrustedString_eq(uint64_t a, uint64_t b) {
27935         LDKUntrustedString a_conv;
27936         a_conv.inner = untag_ptr(a);
27937         a_conv.is_owned = ptr_is_owned(a);
27938         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27939         a_conv.is_owned = false;
27940         LDKUntrustedString b_conv;
27941         b_conv.inner = untag_ptr(b);
27942         b_conv.is_owned = ptr_is_owned(b);
27943         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27944         b_conv.is_owned = false;
27945         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
27946         return ret_conv;
27947 }
27948
27949 int8_tArray  __attribute__((export_name("TS_UntrustedString_write"))) TS_UntrustedString_write(uint64_t obj) {
27950         LDKUntrustedString obj_conv;
27951         obj_conv.inner = untag_ptr(obj);
27952         obj_conv.is_owned = ptr_is_owned(obj);
27953         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
27954         obj_conv.is_owned = false;
27955         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
27956         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
27957         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
27958         CVec_u8Z_free(ret_var);
27959         return ret_arr;
27960 }
27961
27962 uint64_t  __attribute__((export_name("TS_UntrustedString_read"))) TS_UntrustedString_read(int8_tArray ser) {
27963         LDKu8slice ser_ref;
27964         ser_ref.datalen = ser->arr_len;
27965         ser_ref.data = ser->elems;
27966         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
27967         *ret_conv = UntrustedString_read(ser_ref);
27968         FREE(ser);
27969         return tag_ptr(ret_conv, true);
27970 }
27971
27972 void  __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) {
27973         LDKPrintableString this_obj_conv;
27974         this_obj_conv.inner = untag_ptr(this_obj);
27975         this_obj_conv.is_owned = ptr_is_owned(this_obj);
27976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
27977         PrintableString_free(this_obj_conv);
27978 }
27979
27980 jstring  __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) {
27981         LDKPrintableString this_ptr_conv;
27982         this_ptr_conv.inner = untag_ptr(this_ptr);
27983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27985         this_ptr_conv.is_owned = false;
27986         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
27987         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
27988         Str_free(ret_str);
27989         return ret_conv;
27990 }
27991
27992 void  __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) {
27993         LDKPrintableString this_ptr_conv;
27994         this_ptr_conv.inner = untag_ptr(this_ptr);
27995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
27996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
27997         this_ptr_conv.is_owned = false;
27998         LDKStr val_conv = str_ref_to_owned_c(val);
27999         PrintableString_set_a(&this_ptr_conv, val_conv);
28000 }
28001
28002 uint64_t  __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) {
28003         LDKStr a_arg_conv = str_ref_to_owned_c(a_arg);
28004         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
28005         uint64_t ret_ref = 0;
28006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28008         return ret_ref;
28009 }
28010
28011 void  __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) {
28012         if (!ptr_is_owned(this_ptr)) return;
28013         void* this_ptr_ptr = untag_ptr(this_ptr);
28014         CHECK_ACCESS(this_ptr_ptr);
28015         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
28016         FREE(untag_ptr(this_ptr));
28017         FutureCallback_free(this_ptr_conv);
28018 }
28019
28020 void  __attribute__((export_name("TS_Future_free"))) TS_Future_free(uint64_t this_obj) {
28021         LDKFuture this_obj_conv;
28022         this_obj_conv.inner = untag_ptr(this_obj);
28023         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28025         Future_free(this_obj_conv);
28026 }
28027
28028 static inline uint64_t Future_clone_ptr(LDKFuture *NONNULL_PTR arg) {
28029         LDKFuture ret_var = Future_clone(arg);
28030         uint64_t ret_ref = 0;
28031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28033         return ret_ref;
28034 }
28035 int64_t  __attribute__((export_name("TS_Future_clone_ptr"))) TS_Future_clone_ptr(uint64_t arg) {
28036         LDKFuture arg_conv;
28037         arg_conv.inner = untag_ptr(arg);
28038         arg_conv.is_owned = ptr_is_owned(arg);
28039         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28040         arg_conv.is_owned = false;
28041         int64_t ret_conv = Future_clone_ptr(&arg_conv);
28042         return ret_conv;
28043 }
28044
28045 uint64_t  __attribute__((export_name("TS_Future_clone"))) TS_Future_clone(uint64_t orig) {
28046         LDKFuture orig_conv;
28047         orig_conv.inner = untag_ptr(orig);
28048         orig_conv.is_owned = ptr_is_owned(orig);
28049         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28050         orig_conv.is_owned = false;
28051         LDKFuture ret_var = Future_clone(&orig_conv);
28052         uint64_t ret_ref = 0;
28053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28055         return ret_ref;
28056 }
28057
28058 void  __attribute__((export_name("TS_Future_register_callback_fn"))) TS_Future_register_callback_fn(uint64_t this_arg, uint64_t callback) {
28059         LDKFuture this_arg_conv;
28060         this_arg_conv.inner = untag_ptr(this_arg);
28061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
28062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
28063         this_arg_conv.is_owned = false;
28064         void* callback_ptr = untag_ptr(callback);
28065         CHECK_ACCESS(callback_ptr);
28066         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
28067         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
28068                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28069                 LDKFutureCallback_JCalls_cloned(&callback_conv);
28070         }
28071         Future_register_callback_fn(&this_arg_conv, callback_conv);
28072 }
28073
28074 uint32_t  __attribute__((export_name("TS_Level_clone"))) TS_Level_clone(uint64_t orig) {
28075         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
28076         uint32_t ret_conv = LDKLevel_to_js(Level_clone(orig_conv));
28077         return ret_conv;
28078 }
28079
28080 uint32_t  __attribute__((export_name("TS_Level_gossip"))) TS_Level_gossip() {
28081         uint32_t ret_conv = LDKLevel_to_js(Level_gossip());
28082         return ret_conv;
28083 }
28084
28085 uint32_t  __attribute__((export_name("TS_Level_trace"))) TS_Level_trace() {
28086         uint32_t ret_conv = LDKLevel_to_js(Level_trace());
28087         return ret_conv;
28088 }
28089
28090 uint32_t  __attribute__((export_name("TS_Level_debug"))) TS_Level_debug() {
28091         uint32_t ret_conv = LDKLevel_to_js(Level_debug());
28092         return ret_conv;
28093 }
28094
28095 uint32_t  __attribute__((export_name("TS_Level_info"))) TS_Level_info() {
28096         uint32_t ret_conv = LDKLevel_to_js(Level_info());
28097         return ret_conv;
28098 }
28099
28100 uint32_t  __attribute__((export_name("TS_Level_warn"))) TS_Level_warn() {
28101         uint32_t ret_conv = LDKLevel_to_js(Level_warn());
28102         return ret_conv;
28103 }
28104
28105 uint32_t  __attribute__((export_name("TS_Level_error"))) TS_Level_error() {
28106         uint32_t ret_conv = LDKLevel_to_js(Level_error());
28107         return ret_conv;
28108 }
28109
28110 jboolean  __attribute__((export_name("TS_Level_eq"))) TS_Level_eq(uint64_t a, uint64_t b) {
28111         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
28112         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
28113         jboolean ret_conv = Level_eq(a_conv, b_conv);
28114         return ret_conv;
28115 }
28116
28117 int64_t  __attribute__((export_name("TS_Level_hash"))) TS_Level_hash(uint64_t o) {
28118         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
28119         int64_t ret_conv = Level_hash(o_conv);
28120         return ret_conv;
28121 }
28122
28123 uint32_t  __attribute__((export_name("TS_Level_max"))) TS_Level_max() {
28124         uint32_t ret_conv = LDKLevel_to_js(Level_max());
28125         return ret_conv;
28126 }
28127
28128 void  __attribute__((export_name("TS_Record_free"))) TS_Record_free(uint64_t this_obj) {
28129         LDKRecord this_obj_conv;
28130         this_obj_conv.inner = untag_ptr(this_obj);
28131         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28133         Record_free(this_obj_conv);
28134 }
28135
28136 uint32_t  __attribute__((export_name("TS_Record_get_level"))) TS_Record_get_level(uint64_t this_ptr) {
28137         LDKRecord this_ptr_conv;
28138         this_ptr_conv.inner = untag_ptr(this_ptr);
28139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28141         this_ptr_conv.is_owned = false;
28142         uint32_t ret_conv = LDKLevel_to_js(Record_get_level(&this_ptr_conv));
28143         return ret_conv;
28144 }
28145
28146 void  __attribute__((export_name("TS_Record_set_level"))) TS_Record_set_level(uint64_t this_ptr, uint32_t val) {
28147         LDKRecord this_ptr_conv;
28148         this_ptr_conv.inner = untag_ptr(this_ptr);
28149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28151         this_ptr_conv.is_owned = false;
28152         LDKLevel val_conv = LDKLevel_from_js(val);
28153         Record_set_level(&this_ptr_conv, val_conv);
28154 }
28155
28156 jstring  __attribute__((export_name("TS_Record_get_args"))) TS_Record_get_args(uint64_t this_ptr) {
28157         LDKRecord this_ptr_conv;
28158         this_ptr_conv.inner = untag_ptr(this_ptr);
28159         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28161         this_ptr_conv.is_owned = false;
28162         LDKStr ret_str = Record_get_args(&this_ptr_conv);
28163         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28164         Str_free(ret_str);
28165         return ret_conv;
28166 }
28167
28168 void  __attribute__((export_name("TS_Record_set_args"))) TS_Record_set_args(uint64_t this_ptr, jstring val) {
28169         LDKRecord this_ptr_conv;
28170         this_ptr_conv.inner = untag_ptr(this_ptr);
28171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28173         this_ptr_conv.is_owned = false;
28174         LDKStr val_conv = str_ref_to_owned_c(val);
28175         Record_set_args(&this_ptr_conv, val_conv);
28176 }
28177
28178 jstring  __attribute__((export_name("TS_Record_get_module_path"))) TS_Record_get_module_path(uint64_t this_ptr) {
28179         LDKRecord this_ptr_conv;
28180         this_ptr_conv.inner = untag_ptr(this_ptr);
28181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28183         this_ptr_conv.is_owned = false;
28184         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
28185         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28186         Str_free(ret_str);
28187         return ret_conv;
28188 }
28189
28190 void  __attribute__((export_name("TS_Record_set_module_path"))) TS_Record_set_module_path(uint64_t this_ptr, jstring val) {
28191         LDKRecord this_ptr_conv;
28192         this_ptr_conv.inner = untag_ptr(this_ptr);
28193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28195         this_ptr_conv.is_owned = false;
28196         LDKStr val_conv = str_ref_to_owned_c(val);
28197         Record_set_module_path(&this_ptr_conv, val_conv);
28198 }
28199
28200 jstring  __attribute__((export_name("TS_Record_get_file"))) TS_Record_get_file(uint64_t this_ptr) {
28201         LDKRecord this_ptr_conv;
28202         this_ptr_conv.inner = untag_ptr(this_ptr);
28203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28205         this_ptr_conv.is_owned = false;
28206         LDKStr ret_str = Record_get_file(&this_ptr_conv);
28207         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
28208         Str_free(ret_str);
28209         return ret_conv;
28210 }
28211
28212 void  __attribute__((export_name("TS_Record_set_file"))) TS_Record_set_file(uint64_t this_ptr, jstring val) {
28213         LDKRecord this_ptr_conv;
28214         this_ptr_conv.inner = untag_ptr(this_ptr);
28215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28217         this_ptr_conv.is_owned = false;
28218         LDKStr val_conv = str_ref_to_owned_c(val);
28219         Record_set_file(&this_ptr_conv, val_conv);
28220 }
28221
28222 int32_t  __attribute__((export_name("TS_Record_get_line"))) TS_Record_get_line(uint64_t this_ptr) {
28223         LDKRecord this_ptr_conv;
28224         this_ptr_conv.inner = untag_ptr(this_ptr);
28225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28227         this_ptr_conv.is_owned = false;
28228         int32_t ret_conv = Record_get_line(&this_ptr_conv);
28229         return ret_conv;
28230 }
28231
28232 void  __attribute__((export_name("TS_Record_set_line"))) TS_Record_set_line(uint64_t this_ptr, int32_t val) {
28233         LDKRecord this_ptr_conv;
28234         this_ptr_conv.inner = untag_ptr(this_ptr);
28235         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28237         this_ptr_conv.is_owned = false;
28238         Record_set_line(&this_ptr_conv, val);
28239 }
28240
28241 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
28242         LDKRecord ret_var = Record_clone(arg);
28243         uint64_t ret_ref = 0;
28244         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28245         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28246         return ret_ref;
28247 }
28248 int64_t  __attribute__((export_name("TS_Record_clone_ptr"))) TS_Record_clone_ptr(uint64_t arg) {
28249         LDKRecord arg_conv;
28250         arg_conv.inner = untag_ptr(arg);
28251         arg_conv.is_owned = ptr_is_owned(arg);
28252         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28253         arg_conv.is_owned = false;
28254         int64_t ret_conv = Record_clone_ptr(&arg_conv);
28255         return ret_conv;
28256 }
28257
28258 uint64_t  __attribute__((export_name("TS_Record_clone"))) TS_Record_clone(uint64_t orig) {
28259         LDKRecord orig_conv;
28260         orig_conv.inner = untag_ptr(orig);
28261         orig_conv.is_owned = ptr_is_owned(orig);
28262         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28263         orig_conv.is_owned = false;
28264         LDKRecord ret_var = Record_clone(&orig_conv);
28265         uint64_t ret_ref = 0;
28266         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28267         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28268         return ret_ref;
28269 }
28270
28271 void  __attribute__((export_name("TS_Logger_free"))) TS_Logger_free(uint64_t this_ptr) {
28272         if (!ptr_is_owned(this_ptr)) return;
28273         void* this_ptr_ptr = untag_ptr(this_ptr);
28274         CHECK_ACCESS(this_ptr_ptr);
28275         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
28276         FREE(untag_ptr(this_ptr));
28277         Logger_free(this_ptr_conv);
28278 }
28279
28280 void  __attribute__((export_name("TS_ChannelHandshakeConfig_free"))) TS_ChannelHandshakeConfig_free(uint64_t this_obj) {
28281         LDKChannelHandshakeConfig this_obj_conv;
28282         this_obj_conv.inner = untag_ptr(this_obj);
28283         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28285         ChannelHandshakeConfig_free(this_obj_conv);
28286 }
28287
28288 int32_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_minimum_depth"))) TS_ChannelHandshakeConfig_get_minimum_depth(uint64_t this_ptr) {
28289         LDKChannelHandshakeConfig this_ptr_conv;
28290         this_ptr_conv.inner = untag_ptr(this_ptr);
28291         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28293         this_ptr_conv.is_owned = false;
28294         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
28295         return ret_conv;
28296 }
28297
28298 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_minimum_depth"))) TS_ChannelHandshakeConfig_set_minimum_depth(uint64_t this_ptr, int32_t val) {
28299         LDKChannelHandshakeConfig this_ptr_conv;
28300         this_ptr_conv.inner = untag_ptr(this_ptr);
28301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28303         this_ptr_conv.is_owned = false;
28304         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
28305 }
28306
28307 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_to_self_delay"))) TS_ChannelHandshakeConfig_get_our_to_self_delay(uint64_t this_ptr) {
28308         LDKChannelHandshakeConfig this_ptr_conv;
28309         this_ptr_conv.inner = untag_ptr(this_ptr);
28310         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28312         this_ptr_conv.is_owned = false;
28313         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
28314         return ret_conv;
28315 }
28316
28317 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) {
28318         LDKChannelHandshakeConfig this_ptr_conv;
28319         this_ptr_conv.inner = untag_ptr(this_ptr);
28320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28322         this_ptr_conv.is_owned = false;
28323         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
28324 }
28325
28326 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat"))) TS_ChannelHandshakeConfig_get_our_htlc_minimum_msat(uint64_t this_ptr) {
28327         LDKChannelHandshakeConfig this_ptr_conv;
28328         this_ptr_conv.inner = untag_ptr(this_ptr);
28329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28331         this_ptr_conv.is_owned = false;
28332         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
28333         return ret_conv;
28334 }
28335
28336 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) {
28337         LDKChannelHandshakeConfig this_ptr_conv;
28338         this_ptr_conv.inner = untag_ptr(this_ptr);
28339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28341         this_ptr_conv.is_owned = false;
28342         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
28343 }
28344
28345 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) {
28346         LDKChannelHandshakeConfig this_ptr_conv;
28347         this_ptr_conv.inner = untag_ptr(this_ptr);
28348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28350         this_ptr_conv.is_owned = false;
28351         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
28352         return ret_conv;
28353 }
28354
28355 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) {
28356         LDKChannelHandshakeConfig this_ptr_conv;
28357         this_ptr_conv.inner = untag_ptr(this_ptr);
28358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28360         this_ptr_conv.is_owned = false;
28361         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
28362 }
28363
28364 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_get_negotiate_scid_privacy(uint64_t this_ptr) {
28365         LDKChannelHandshakeConfig this_ptr_conv;
28366         this_ptr_conv.inner = untag_ptr(this_ptr);
28367         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28369         this_ptr_conv.is_owned = false;
28370         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
28371         return ret_conv;
28372 }
28373
28374 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_negotiate_scid_privacy"))) TS_ChannelHandshakeConfig_set_negotiate_scid_privacy(uint64_t this_ptr, jboolean val) {
28375         LDKChannelHandshakeConfig this_ptr_conv;
28376         this_ptr_conv.inner = untag_ptr(this_ptr);
28377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28379         this_ptr_conv.is_owned = false;
28380         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
28381 }
28382
28383 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_announced_channel"))) TS_ChannelHandshakeConfig_get_announced_channel(uint64_t this_ptr) {
28384         LDKChannelHandshakeConfig this_ptr_conv;
28385         this_ptr_conv.inner = untag_ptr(this_ptr);
28386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28388         this_ptr_conv.is_owned = false;
28389         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
28390         return ret_conv;
28391 }
28392
28393 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_announced_channel"))) TS_ChannelHandshakeConfig_set_announced_channel(uint64_t this_ptr, jboolean val) {
28394         LDKChannelHandshakeConfig this_ptr_conv;
28395         this_ptr_conv.inner = untag_ptr(this_ptr);
28396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28398         this_ptr_conv.is_owned = false;
28399         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
28400 }
28401
28402 jboolean  __attribute__((export_name("TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(uint64_t this_ptr) {
28403         LDKChannelHandshakeConfig this_ptr_conv;
28404         this_ptr_conv.inner = untag_ptr(this_ptr);
28405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28407         this_ptr_conv.is_owned = false;
28408         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
28409         return ret_conv;
28410 }
28411
28412 void  __attribute__((export_name("TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey"))) TS_ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(uint64_t this_ptr, jboolean val) {
28413         LDKChannelHandshakeConfig this_ptr_conv;
28414         this_ptr_conv.inner = untag_ptr(this_ptr);
28415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28417         this_ptr_conv.is_owned = false;
28418         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
28419 }
28420
28421 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) {
28422         LDKChannelHandshakeConfig this_ptr_conv;
28423         this_ptr_conv.inner = untag_ptr(this_ptr);
28424         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28426         this_ptr_conv.is_owned = false;
28427         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
28428         return ret_conv;
28429 }
28430
28431 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) {
28432         LDKChannelHandshakeConfig this_ptr_conv;
28433         this_ptr_conv.inner = untag_ptr(this_ptr);
28434         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28436         this_ptr_conv.is_owned = false;
28437         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
28438 }
28439
28440 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) {
28441         LDKChannelHandshakeConfig this_ptr_conv;
28442         this_ptr_conv.inner = untag_ptr(this_ptr);
28443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28445         this_ptr_conv.is_owned = false;
28446         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
28447         return ret_conv;
28448 }
28449
28450 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) {
28451         LDKChannelHandshakeConfig this_ptr_conv;
28452         this_ptr_conv.inner = untag_ptr(this_ptr);
28453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28455         this_ptr_conv.is_owned = false;
28456         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
28457 }
28458
28459 int16_t  __attribute__((export_name("TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs"))) TS_ChannelHandshakeConfig_get_our_max_accepted_htlcs(uint64_t this_ptr) {
28460         LDKChannelHandshakeConfig this_ptr_conv;
28461         this_ptr_conv.inner = untag_ptr(this_ptr);
28462         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28464         this_ptr_conv.is_owned = false;
28465         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
28466         return ret_conv;
28467 }
28468
28469 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) {
28470         LDKChannelHandshakeConfig this_ptr_conv;
28471         this_ptr_conv.inner = untag_ptr(this_ptr);
28472         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28474         this_ptr_conv.is_owned = false;
28475         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
28476 }
28477
28478 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) {
28479         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);
28480         uint64_t ret_ref = 0;
28481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28483         return ret_ref;
28484 }
28485
28486 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
28487         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
28488         uint64_t ret_ref = 0;
28489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28491         return ret_ref;
28492 }
28493 int64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone_ptr"))) TS_ChannelHandshakeConfig_clone_ptr(uint64_t arg) {
28494         LDKChannelHandshakeConfig arg_conv;
28495         arg_conv.inner = untag_ptr(arg);
28496         arg_conv.is_owned = ptr_is_owned(arg);
28497         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28498         arg_conv.is_owned = false;
28499         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
28500         return ret_conv;
28501 }
28502
28503 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_clone"))) TS_ChannelHandshakeConfig_clone(uint64_t orig) {
28504         LDKChannelHandshakeConfig orig_conv;
28505         orig_conv.inner = untag_ptr(orig);
28506         orig_conv.is_owned = ptr_is_owned(orig);
28507         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28508         orig_conv.is_owned = false;
28509         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
28510         uint64_t ret_ref = 0;
28511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28513         return ret_ref;
28514 }
28515
28516 uint64_t  __attribute__((export_name("TS_ChannelHandshakeConfig_default"))) TS_ChannelHandshakeConfig_default() {
28517         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
28518         uint64_t ret_ref = 0;
28519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28521         return ret_ref;
28522 }
28523
28524 void  __attribute__((export_name("TS_ChannelHandshakeLimits_free"))) TS_ChannelHandshakeLimits_free(uint64_t this_obj) {
28525         LDKChannelHandshakeLimits this_obj_conv;
28526         this_obj_conv.inner = untag_ptr(this_obj);
28527         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28529         ChannelHandshakeLimits_free(this_obj_conv);
28530 }
28531
28532 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_funding_satoshis"))) TS_ChannelHandshakeLimits_get_min_funding_satoshis(uint64_t this_ptr) {
28533         LDKChannelHandshakeLimits this_ptr_conv;
28534         this_ptr_conv.inner = untag_ptr(this_ptr);
28535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28537         this_ptr_conv.is_owned = false;
28538         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
28539         return ret_conv;
28540 }
28541
28542 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_min_funding_satoshis"))) TS_ChannelHandshakeLimits_set_min_funding_satoshis(uint64_t this_ptr, int64_t val) {
28543         LDKChannelHandshakeLimits this_ptr_conv;
28544         this_ptr_conv.inner = untag_ptr(this_ptr);
28545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28547         this_ptr_conv.is_owned = false;
28548         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
28549 }
28550
28551 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_funding_satoshis"))) TS_ChannelHandshakeLimits_get_max_funding_satoshis(uint64_t this_ptr) {
28552         LDKChannelHandshakeLimits this_ptr_conv;
28553         this_ptr_conv.inner = untag_ptr(this_ptr);
28554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28556         this_ptr_conv.is_owned = false;
28557         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
28558         return ret_conv;
28559 }
28560
28561 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_funding_satoshis"))) TS_ChannelHandshakeLimits_set_max_funding_satoshis(uint64_t this_ptr, int64_t val) {
28562         LDKChannelHandshakeLimits this_ptr_conv;
28563         this_ptr_conv.inner = untag_ptr(this_ptr);
28564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28566         this_ptr_conv.is_owned = false;
28567         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
28568 }
28569
28570 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat"))) TS_ChannelHandshakeLimits_get_max_htlc_minimum_msat(uint64_t this_ptr) {
28571         LDKChannelHandshakeLimits this_ptr_conv;
28572         this_ptr_conv.inner = untag_ptr(this_ptr);
28573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28575         this_ptr_conv.is_owned = false;
28576         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
28577         return ret_conv;
28578 }
28579
28580 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) {
28581         LDKChannelHandshakeLimits this_ptr_conv;
28582         this_ptr_conv.inner = untag_ptr(this_ptr);
28583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28585         this_ptr_conv.is_owned = false;
28586         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
28587 }
28588
28589 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) {
28590         LDKChannelHandshakeLimits this_ptr_conv;
28591         this_ptr_conv.inner = untag_ptr(this_ptr);
28592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28594         this_ptr_conv.is_owned = false;
28595         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
28596         return ret_conv;
28597 }
28598
28599 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) {
28600         LDKChannelHandshakeLimits this_ptr_conv;
28601         this_ptr_conv.inner = untag_ptr(this_ptr);
28602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28604         this_ptr_conv.is_owned = false;
28605         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
28606 }
28607
28608 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis"))) TS_ChannelHandshakeLimits_get_max_channel_reserve_satoshis(uint64_t this_ptr) {
28609         LDKChannelHandshakeLimits this_ptr_conv;
28610         this_ptr_conv.inner = untag_ptr(this_ptr);
28611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28613         this_ptr_conv.is_owned = false;
28614         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
28615         return ret_conv;
28616 }
28617
28618 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) {
28619         LDKChannelHandshakeLimits this_ptr_conv;
28620         this_ptr_conv.inner = untag_ptr(this_ptr);
28621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28623         this_ptr_conv.is_owned = false;
28624         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
28625 }
28626
28627 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs"))) TS_ChannelHandshakeLimits_get_min_max_accepted_htlcs(uint64_t this_ptr) {
28628         LDKChannelHandshakeLimits this_ptr_conv;
28629         this_ptr_conv.inner = untag_ptr(this_ptr);
28630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28632         this_ptr_conv.is_owned = false;
28633         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
28634         return ret_conv;
28635 }
28636
28637 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) {
28638         LDKChannelHandshakeLimits this_ptr_conv;
28639         this_ptr_conv.inner = untag_ptr(this_ptr);
28640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28642         this_ptr_conv.is_owned = false;
28643         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
28644 }
28645
28646 int32_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_max_minimum_depth"))) TS_ChannelHandshakeLimits_get_max_minimum_depth(uint64_t this_ptr) {
28647         LDKChannelHandshakeLimits this_ptr_conv;
28648         this_ptr_conv.inner = untag_ptr(this_ptr);
28649         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28651         this_ptr_conv.is_owned = false;
28652         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
28653         return ret_conv;
28654 }
28655
28656 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_max_minimum_depth"))) TS_ChannelHandshakeLimits_set_max_minimum_depth(uint64_t this_ptr, int32_t val) {
28657         LDKChannelHandshakeLimits this_ptr_conv;
28658         this_ptr_conv.inner = untag_ptr(this_ptr);
28659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28661         this_ptr_conv.is_owned = false;
28662         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
28663 }
28664
28665 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_get_trust_own_funding_0conf(uint64_t this_ptr) {
28666         LDKChannelHandshakeLimits this_ptr_conv;
28667         this_ptr_conv.inner = untag_ptr(this_ptr);
28668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28670         this_ptr_conv.is_owned = false;
28671         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
28672         return ret_conv;
28673 }
28674
28675 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_trust_own_funding_0conf"))) TS_ChannelHandshakeLimits_set_trust_own_funding_0conf(uint64_t this_ptr, jboolean val) {
28676         LDKChannelHandshakeLimits this_ptr_conv;
28677         this_ptr_conv.inner = untag_ptr(this_ptr);
28678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28680         this_ptr_conv.is_owned = false;
28681         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
28682 }
28683
28684 jboolean  __attribute__((export_name("TS_ChannelHandshakeLimits_get_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_get_force_announced_channel_preference(uint64_t this_ptr) {
28685         LDKChannelHandshakeLimits this_ptr_conv;
28686         this_ptr_conv.inner = untag_ptr(this_ptr);
28687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28689         this_ptr_conv.is_owned = false;
28690         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
28691         return ret_conv;
28692 }
28693
28694 void  __attribute__((export_name("TS_ChannelHandshakeLimits_set_force_announced_channel_preference"))) TS_ChannelHandshakeLimits_set_force_announced_channel_preference(uint64_t this_ptr, jboolean val) {
28695         LDKChannelHandshakeLimits this_ptr_conv;
28696         this_ptr_conv.inner = untag_ptr(this_ptr);
28697         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28698         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28699         this_ptr_conv.is_owned = false;
28700         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
28701 }
28702
28703 int16_t  __attribute__((export_name("TS_ChannelHandshakeLimits_get_their_to_self_delay"))) TS_ChannelHandshakeLimits_get_their_to_self_delay(uint64_t this_ptr) {
28704         LDKChannelHandshakeLimits this_ptr_conv;
28705         this_ptr_conv.inner = untag_ptr(this_ptr);
28706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28708         this_ptr_conv.is_owned = false;
28709         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
28710         return ret_conv;
28711 }
28712
28713 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) {
28714         LDKChannelHandshakeLimits this_ptr_conv;
28715         this_ptr_conv.inner = untag_ptr(this_ptr);
28716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28718         this_ptr_conv.is_owned = false;
28719         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
28720 }
28721
28722 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) {
28723         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);
28724         uint64_t ret_ref = 0;
28725         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28726         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28727         return ret_ref;
28728 }
28729
28730 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
28731         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
28732         uint64_t ret_ref = 0;
28733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28735         return ret_ref;
28736 }
28737 int64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone_ptr"))) TS_ChannelHandshakeLimits_clone_ptr(uint64_t arg) {
28738         LDKChannelHandshakeLimits arg_conv;
28739         arg_conv.inner = untag_ptr(arg);
28740         arg_conv.is_owned = ptr_is_owned(arg);
28741         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28742         arg_conv.is_owned = false;
28743         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
28744         return ret_conv;
28745 }
28746
28747 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_clone"))) TS_ChannelHandshakeLimits_clone(uint64_t orig) {
28748         LDKChannelHandshakeLimits orig_conv;
28749         orig_conv.inner = untag_ptr(orig);
28750         orig_conv.is_owned = ptr_is_owned(orig);
28751         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28752         orig_conv.is_owned = false;
28753         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
28754         uint64_t ret_ref = 0;
28755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28757         return ret_ref;
28758 }
28759
28760 uint64_t  __attribute__((export_name("TS_ChannelHandshakeLimits_default"))) TS_ChannelHandshakeLimits_default() {
28761         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
28762         uint64_t ret_ref = 0;
28763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28765         return ret_ref;
28766 }
28767
28768 void  __attribute__((export_name("TS_MaxDustHTLCExposure_free"))) TS_MaxDustHTLCExposure_free(uint64_t this_ptr) {
28769         if (!ptr_is_owned(this_ptr)) return;
28770         void* this_ptr_ptr = untag_ptr(this_ptr);
28771         CHECK_ACCESS(this_ptr_ptr);
28772         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
28773         FREE(untag_ptr(this_ptr));
28774         MaxDustHTLCExposure_free(this_ptr_conv);
28775 }
28776
28777 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
28778         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28779         *ret_copy = MaxDustHTLCExposure_clone(arg);
28780         uint64_t ret_ref = tag_ptr(ret_copy, true);
28781         return ret_ref;
28782 }
28783 int64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone_ptr"))) TS_MaxDustHTLCExposure_clone_ptr(uint64_t arg) {
28784         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
28785         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
28786         return ret_conv;
28787 }
28788
28789 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_clone"))) TS_MaxDustHTLCExposure_clone(uint64_t orig) {
28790         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
28791         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28792         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
28793         uint64_t ret_ref = tag_ptr(ret_copy, true);
28794         return ret_ref;
28795 }
28796
28797 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fixed_limit_msat"))) TS_MaxDustHTLCExposure_fixed_limit_msat(int64_t a) {
28798         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28799         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
28800         uint64_t ret_ref = tag_ptr(ret_copy, true);
28801         return ret_ref;
28802 }
28803
28804 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_fee_rate_multiplier"))) TS_MaxDustHTLCExposure_fee_rate_multiplier(int64_t a) {
28805         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28806         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
28807         uint64_t ret_ref = tag_ptr(ret_copy, true);
28808         return ret_ref;
28809 }
28810
28811 jboolean  __attribute__((export_name("TS_MaxDustHTLCExposure_eq"))) TS_MaxDustHTLCExposure_eq(uint64_t a, uint64_t b) {
28812         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
28813         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
28814         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
28815         return ret_conv;
28816 }
28817
28818 int8_tArray  __attribute__((export_name("TS_MaxDustHTLCExposure_write"))) TS_MaxDustHTLCExposure_write(uint64_t obj) {
28819         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
28820         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
28821         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
28822         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
28823         CVec_u8Z_free(ret_var);
28824         return ret_arr;
28825 }
28826
28827 uint64_t  __attribute__((export_name("TS_MaxDustHTLCExposure_read"))) TS_MaxDustHTLCExposure_read(int8_tArray ser) {
28828         LDKu8slice ser_ref;
28829         ser_ref.datalen = ser->arr_len;
28830         ser_ref.data = ser->elems;
28831         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
28832         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
28833         FREE(ser);
28834         return tag_ptr(ret_conv, true);
28835 }
28836
28837 void  __attribute__((export_name("TS_ChannelConfig_free"))) TS_ChannelConfig_free(uint64_t this_obj) {
28838         LDKChannelConfig this_obj_conv;
28839         this_obj_conv.inner = untag_ptr(this_obj);
28840         this_obj_conv.is_owned = ptr_is_owned(this_obj);
28841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
28842         ChannelConfig_free(this_obj_conv);
28843 }
28844
28845 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfig_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
28846         LDKChannelConfig this_ptr_conv;
28847         this_ptr_conv.inner = untag_ptr(this_ptr);
28848         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28849         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28850         this_ptr_conv.is_owned = false;
28851         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
28852         return ret_conv;
28853 }
28854
28855 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) {
28856         LDKChannelConfig this_ptr_conv;
28857         this_ptr_conv.inner = untag_ptr(this_ptr);
28858         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28860         this_ptr_conv.is_owned = false;
28861         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
28862 }
28863
28864 int32_t  __attribute__((export_name("TS_ChannelConfig_get_forwarding_fee_base_msat"))) TS_ChannelConfig_get_forwarding_fee_base_msat(uint64_t this_ptr) {
28865         LDKChannelConfig this_ptr_conv;
28866         this_ptr_conv.inner = untag_ptr(this_ptr);
28867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28869         this_ptr_conv.is_owned = false;
28870         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
28871         return ret_conv;
28872 }
28873
28874 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) {
28875         LDKChannelConfig this_ptr_conv;
28876         this_ptr_conv.inner = untag_ptr(this_ptr);
28877         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28879         this_ptr_conv.is_owned = false;
28880         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
28881 }
28882
28883 int16_t  __attribute__((export_name("TS_ChannelConfig_get_cltv_expiry_delta"))) TS_ChannelConfig_get_cltv_expiry_delta(uint64_t this_ptr) {
28884         LDKChannelConfig this_ptr_conv;
28885         this_ptr_conv.inner = untag_ptr(this_ptr);
28886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28888         this_ptr_conv.is_owned = false;
28889         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
28890         return ret_conv;
28891 }
28892
28893 void  __attribute__((export_name("TS_ChannelConfig_set_cltv_expiry_delta"))) TS_ChannelConfig_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
28894         LDKChannelConfig this_ptr_conv;
28895         this_ptr_conv.inner = untag_ptr(this_ptr);
28896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28898         this_ptr_conv.is_owned = false;
28899         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
28900 }
28901
28902 uint64_t  __attribute__((export_name("TS_ChannelConfig_get_max_dust_htlc_exposure"))) TS_ChannelConfig_get_max_dust_htlc_exposure(uint64_t this_ptr) {
28903         LDKChannelConfig this_ptr_conv;
28904         this_ptr_conv.inner = untag_ptr(this_ptr);
28905         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28907         this_ptr_conv.is_owned = false;
28908         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
28909         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
28910         uint64_t ret_ref = tag_ptr(ret_copy, true);
28911         return ret_ref;
28912 }
28913
28914 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) {
28915         LDKChannelConfig this_ptr_conv;
28916         this_ptr_conv.inner = untag_ptr(this_ptr);
28917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28919         this_ptr_conv.is_owned = false;
28920         void* val_ptr = untag_ptr(val);
28921         CHECK_ACCESS(val_ptr);
28922         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
28923         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
28924         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
28925 }
28926
28927 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) {
28928         LDKChannelConfig this_ptr_conv;
28929         this_ptr_conv.inner = untag_ptr(this_ptr);
28930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28932         this_ptr_conv.is_owned = false;
28933         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
28934         return ret_conv;
28935 }
28936
28937 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) {
28938         LDKChannelConfig this_ptr_conv;
28939         this_ptr_conv.inner = untag_ptr(this_ptr);
28940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28942         this_ptr_conv.is_owned = false;
28943         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
28944 }
28945
28946 jboolean  __attribute__((export_name("TS_ChannelConfig_get_accept_underpaying_htlcs"))) TS_ChannelConfig_get_accept_underpaying_htlcs(uint64_t this_ptr) {
28947         LDKChannelConfig this_ptr_conv;
28948         this_ptr_conv.inner = untag_ptr(this_ptr);
28949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28951         this_ptr_conv.is_owned = false;
28952         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
28953         return ret_conv;
28954 }
28955
28956 void  __attribute__((export_name("TS_ChannelConfig_set_accept_underpaying_htlcs"))) TS_ChannelConfig_set_accept_underpaying_htlcs(uint64_t this_ptr, jboolean val) {
28957         LDKChannelConfig this_ptr_conv;
28958         this_ptr_conv.inner = untag_ptr(this_ptr);
28959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
28960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
28961         this_ptr_conv.is_owned = false;
28962         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
28963 }
28964
28965 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) {
28966         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
28967         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
28968         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
28969         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
28970         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);
28971         uint64_t ret_ref = 0;
28972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28974         return ret_ref;
28975 }
28976
28977 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
28978         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
28979         uint64_t ret_ref = 0;
28980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
28981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
28982         return ret_ref;
28983 }
28984 int64_t  __attribute__((export_name("TS_ChannelConfig_clone_ptr"))) TS_ChannelConfig_clone_ptr(uint64_t arg) {
28985         LDKChannelConfig arg_conv;
28986         arg_conv.inner = untag_ptr(arg);
28987         arg_conv.is_owned = ptr_is_owned(arg);
28988         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
28989         arg_conv.is_owned = false;
28990         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
28991         return ret_conv;
28992 }
28993
28994 uint64_t  __attribute__((export_name("TS_ChannelConfig_clone"))) TS_ChannelConfig_clone(uint64_t orig) {
28995         LDKChannelConfig orig_conv;
28996         orig_conv.inner = untag_ptr(orig);
28997         orig_conv.is_owned = ptr_is_owned(orig);
28998         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
28999         orig_conv.is_owned = false;
29000         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
29001         uint64_t ret_ref = 0;
29002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29004         return ret_ref;
29005 }
29006
29007 jboolean  __attribute__((export_name("TS_ChannelConfig_eq"))) TS_ChannelConfig_eq(uint64_t a, uint64_t b) {
29008         LDKChannelConfig a_conv;
29009         a_conv.inner = untag_ptr(a);
29010         a_conv.is_owned = ptr_is_owned(a);
29011         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29012         a_conv.is_owned = false;
29013         LDKChannelConfig b_conv;
29014         b_conv.inner = untag_ptr(b);
29015         b_conv.is_owned = ptr_is_owned(b);
29016         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29017         b_conv.is_owned = false;
29018         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
29019         return ret_conv;
29020 }
29021
29022 void  __attribute__((export_name("TS_ChannelConfig_apply"))) TS_ChannelConfig_apply(uint64_t this_arg, uint64_t update) {
29023         LDKChannelConfig this_arg_conv;
29024         this_arg_conv.inner = untag_ptr(this_arg);
29025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29027         this_arg_conv.is_owned = false;
29028         LDKChannelConfigUpdate update_conv;
29029         update_conv.inner = untag_ptr(update);
29030         update_conv.is_owned = ptr_is_owned(update);
29031         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
29032         update_conv.is_owned = false;
29033         ChannelConfig_apply(&this_arg_conv, &update_conv);
29034 }
29035
29036 uint64_t  __attribute__((export_name("TS_ChannelConfig_default"))) TS_ChannelConfig_default() {
29037         LDKChannelConfig ret_var = ChannelConfig_default();
29038         uint64_t ret_ref = 0;
29039         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29040         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29041         return ret_ref;
29042 }
29043
29044 int8_tArray  __attribute__((export_name("TS_ChannelConfig_write"))) TS_ChannelConfig_write(uint64_t obj) {
29045         LDKChannelConfig obj_conv;
29046         obj_conv.inner = untag_ptr(obj);
29047         obj_conv.is_owned = ptr_is_owned(obj);
29048         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
29049         obj_conv.is_owned = false;
29050         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
29051         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29052         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29053         CVec_u8Z_free(ret_var);
29054         return ret_arr;
29055 }
29056
29057 uint64_t  __attribute__((export_name("TS_ChannelConfig_read"))) TS_ChannelConfig_read(int8_tArray ser) {
29058         LDKu8slice ser_ref;
29059         ser_ref.datalen = ser->arr_len;
29060         ser_ref.data = ser->elems;
29061         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
29062         *ret_conv = ChannelConfig_read(ser_ref);
29063         FREE(ser);
29064         return tag_ptr(ret_conv, true);
29065 }
29066
29067 void  __attribute__((export_name("TS_ChannelConfigUpdate_free"))) TS_ChannelConfigUpdate_free(uint64_t this_obj) {
29068         LDKChannelConfigUpdate this_obj_conv;
29069         this_obj_conv.inner = untag_ptr(this_obj);
29070         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29072         ChannelConfigUpdate_free(this_obj_conv);
29073 }
29074
29075 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths"))) TS_ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(uint64_t this_ptr) {
29076         LDKChannelConfigUpdate this_ptr_conv;
29077         this_ptr_conv.inner = untag_ptr(this_ptr);
29078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29080         this_ptr_conv.is_owned = false;
29081         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29082         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
29083         uint64_t ret_ref = tag_ptr(ret_copy, true);
29084         return ret_ref;
29085 }
29086
29087 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) {
29088         LDKChannelConfigUpdate this_ptr_conv;
29089         this_ptr_conv.inner = untag_ptr(this_ptr);
29090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29092         this_ptr_conv.is_owned = false;
29093         void* val_ptr = untag_ptr(val);
29094         CHECK_ACCESS(val_ptr);
29095         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29096         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
29097         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
29098 }
29099
29100 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_forwarding_fee_base_msat"))) TS_ChannelConfigUpdate_get_forwarding_fee_base_msat(uint64_t this_ptr) {
29101         LDKChannelConfigUpdate this_ptr_conv;
29102         this_ptr_conv.inner = untag_ptr(this_ptr);
29103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29105         this_ptr_conv.is_owned = false;
29106         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
29107         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
29108         uint64_t ret_ref = tag_ptr(ret_copy, true);
29109         return ret_ref;
29110 }
29111
29112 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) {
29113         LDKChannelConfigUpdate this_ptr_conv;
29114         this_ptr_conv.inner = untag_ptr(this_ptr);
29115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29117         this_ptr_conv.is_owned = false;
29118         void* val_ptr = untag_ptr(val);
29119         CHECK_ACCESS(val_ptr);
29120         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
29121         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
29122         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
29123 }
29124
29125 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_get_cltv_expiry_delta"))) TS_ChannelConfigUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
29126         LDKChannelConfigUpdate this_ptr_conv;
29127         this_ptr_conv.inner = untag_ptr(this_ptr);
29128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29130         this_ptr_conv.is_owned = false;
29131         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
29132         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
29133         uint64_t ret_ref = tag_ptr(ret_copy, true);
29134         return ret_ref;
29135 }
29136
29137 void  __attribute__((export_name("TS_ChannelConfigUpdate_set_cltv_expiry_delta"))) TS_ChannelConfigUpdate_set_cltv_expiry_delta(uint64_t this_ptr, uint64_t val) {
29138         LDKChannelConfigUpdate this_ptr_conv;
29139         this_ptr_conv.inner = untag_ptr(this_ptr);
29140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29142         this_ptr_conv.is_owned = false;
29143         void* val_ptr = untag_ptr(val);
29144         CHECK_ACCESS(val_ptr);
29145         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
29146         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
29147         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
29148 }
29149
29150 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) {
29151         LDKChannelConfigUpdate this_ptr_conv;
29152         this_ptr_conv.inner = untag_ptr(this_ptr);
29153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29155         this_ptr_conv.is_owned = false;
29156         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
29157         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
29158         uint64_t ret_ref = tag_ptr(ret_copy, true);
29159         return ret_ref;
29160 }
29161
29162 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) {
29163         LDKChannelConfigUpdate this_ptr_conv;
29164         this_ptr_conv.inner = untag_ptr(this_ptr);
29165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29167         this_ptr_conv.is_owned = false;
29168         void* val_ptr = untag_ptr(val);
29169         CHECK_ACCESS(val_ptr);
29170         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
29171         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
29172         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
29173 }
29174
29175 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) {
29176         LDKChannelConfigUpdate this_ptr_conv;
29177         this_ptr_conv.inner = untag_ptr(this_ptr);
29178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29180         this_ptr_conv.is_owned = false;
29181         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
29182         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
29183         uint64_t ret_ref = tag_ptr(ret_copy, true);
29184         return ret_ref;
29185 }
29186
29187 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) {
29188         LDKChannelConfigUpdate this_ptr_conv;
29189         this_ptr_conv.inner = untag_ptr(this_ptr);
29190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29192         this_ptr_conv.is_owned = false;
29193         void* val_ptr = untag_ptr(val);
29194         CHECK_ACCESS(val_ptr);
29195         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
29196         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
29197         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
29198 }
29199
29200 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) {
29201         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
29202         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
29203         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
29204         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
29205         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
29206         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
29207         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
29208         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
29209         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
29210         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
29211         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
29212         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
29213         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
29214         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
29215         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
29216         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
29217         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
29218         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
29219         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
29220         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
29221         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);
29222         uint64_t ret_ref = 0;
29223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29225         return ret_ref;
29226 }
29227
29228 uint64_t  __attribute__((export_name("TS_ChannelConfigUpdate_default"))) TS_ChannelConfigUpdate_default() {
29229         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
29230         uint64_t ret_ref = 0;
29231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29233         return ret_ref;
29234 }
29235
29236 void  __attribute__((export_name("TS_UserConfig_free"))) TS_UserConfig_free(uint64_t this_obj) {
29237         LDKUserConfig this_obj_conv;
29238         this_obj_conv.inner = untag_ptr(this_obj);
29239         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29241         UserConfig_free(this_obj_conv);
29242 }
29243
29244 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_config"))) TS_UserConfig_get_channel_handshake_config(uint64_t this_ptr) {
29245         LDKUserConfig this_ptr_conv;
29246         this_ptr_conv.inner = untag_ptr(this_ptr);
29247         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29249         this_ptr_conv.is_owned = false;
29250         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
29251         uint64_t ret_ref = 0;
29252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29254         return ret_ref;
29255 }
29256
29257 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_config"))) TS_UserConfig_set_channel_handshake_config(uint64_t this_ptr, uint64_t val) {
29258         LDKUserConfig this_ptr_conv;
29259         this_ptr_conv.inner = untag_ptr(this_ptr);
29260         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29262         this_ptr_conv.is_owned = false;
29263         LDKChannelHandshakeConfig val_conv;
29264         val_conv.inner = untag_ptr(val);
29265         val_conv.is_owned = ptr_is_owned(val);
29266         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29267         val_conv = ChannelHandshakeConfig_clone(&val_conv);
29268         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
29269 }
29270
29271 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_handshake_limits"))) TS_UserConfig_get_channel_handshake_limits(uint64_t this_ptr) {
29272         LDKUserConfig this_ptr_conv;
29273         this_ptr_conv.inner = untag_ptr(this_ptr);
29274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29276         this_ptr_conv.is_owned = false;
29277         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
29278         uint64_t ret_ref = 0;
29279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29281         return ret_ref;
29282 }
29283
29284 void  __attribute__((export_name("TS_UserConfig_set_channel_handshake_limits"))) TS_UserConfig_set_channel_handshake_limits(uint64_t this_ptr, uint64_t val) {
29285         LDKUserConfig this_ptr_conv;
29286         this_ptr_conv.inner = untag_ptr(this_ptr);
29287         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29289         this_ptr_conv.is_owned = false;
29290         LDKChannelHandshakeLimits val_conv;
29291         val_conv.inner = untag_ptr(val);
29292         val_conv.is_owned = ptr_is_owned(val);
29293         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29294         val_conv = ChannelHandshakeLimits_clone(&val_conv);
29295         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
29296 }
29297
29298 uint64_t  __attribute__((export_name("TS_UserConfig_get_channel_config"))) TS_UserConfig_get_channel_config(uint64_t this_ptr) {
29299         LDKUserConfig this_ptr_conv;
29300         this_ptr_conv.inner = untag_ptr(this_ptr);
29301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29303         this_ptr_conv.is_owned = false;
29304         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
29305         uint64_t ret_ref = 0;
29306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29308         return ret_ref;
29309 }
29310
29311 void  __attribute__((export_name("TS_UserConfig_set_channel_config"))) TS_UserConfig_set_channel_config(uint64_t this_ptr, uint64_t val) {
29312         LDKUserConfig this_ptr_conv;
29313         this_ptr_conv.inner = untag_ptr(this_ptr);
29314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29316         this_ptr_conv.is_owned = false;
29317         LDKChannelConfig val_conv;
29318         val_conv.inner = untag_ptr(val);
29319         val_conv.is_owned = ptr_is_owned(val);
29320         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29321         val_conv = ChannelConfig_clone(&val_conv);
29322         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
29323 }
29324
29325 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_forwards_to_priv_channels"))) TS_UserConfig_get_accept_forwards_to_priv_channels(uint64_t this_ptr) {
29326         LDKUserConfig this_ptr_conv;
29327         this_ptr_conv.inner = untag_ptr(this_ptr);
29328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29330         this_ptr_conv.is_owned = false;
29331         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
29332         return ret_conv;
29333 }
29334
29335 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) {
29336         LDKUserConfig this_ptr_conv;
29337         this_ptr_conv.inner = untag_ptr(this_ptr);
29338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29340         this_ptr_conv.is_owned = false;
29341         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
29342 }
29343
29344 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_inbound_channels"))) TS_UserConfig_get_accept_inbound_channels(uint64_t this_ptr) {
29345         LDKUserConfig this_ptr_conv;
29346         this_ptr_conv.inner = untag_ptr(this_ptr);
29347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29349         this_ptr_conv.is_owned = false;
29350         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
29351         return ret_conv;
29352 }
29353
29354 void  __attribute__((export_name("TS_UserConfig_set_accept_inbound_channels"))) TS_UserConfig_set_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
29355         LDKUserConfig this_ptr_conv;
29356         this_ptr_conv.inner = untag_ptr(this_ptr);
29357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29359         this_ptr_conv.is_owned = false;
29360         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
29361 }
29362
29363 jboolean  __attribute__((export_name("TS_UserConfig_get_manually_accept_inbound_channels"))) TS_UserConfig_get_manually_accept_inbound_channels(uint64_t this_ptr) {
29364         LDKUserConfig this_ptr_conv;
29365         this_ptr_conv.inner = untag_ptr(this_ptr);
29366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29368         this_ptr_conv.is_owned = false;
29369         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
29370         return ret_conv;
29371 }
29372
29373 void  __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_channels"))) TS_UserConfig_set_manually_accept_inbound_channels(uint64_t this_ptr, jboolean val) {
29374         LDKUserConfig this_ptr_conv;
29375         this_ptr_conv.inner = untag_ptr(this_ptr);
29376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29378         this_ptr_conv.is_owned = false;
29379         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
29380 }
29381
29382 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) {
29383         LDKUserConfig this_ptr_conv;
29384         this_ptr_conv.inner = untag_ptr(this_ptr);
29385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29387         this_ptr_conv.is_owned = false;
29388         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
29389         return ret_conv;
29390 }
29391
29392 void  __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) {
29393         LDKUserConfig this_ptr_conv;
29394         this_ptr_conv.inner = untag_ptr(this_ptr);
29395         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29397         this_ptr_conv.is_owned = false;
29398         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
29399 }
29400
29401 jboolean  __attribute__((export_name("TS_UserConfig_get_accept_mpp_keysend"))) TS_UserConfig_get_accept_mpp_keysend(uint64_t this_ptr) {
29402         LDKUserConfig this_ptr_conv;
29403         this_ptr_conv.inner = untag_ptr(this_ptr);
29404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29406         this_ptr_conv.is_owned = false;
29407         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
29408         return ret_conv;
29409 }
29410
29411 void  __attribute__((export_name("TS_UserConfig_set_accept_mpp_keysend"))) TS_UserConfig_set_accept_mpp_keysend(uint64_t this_ptr, jboolean val) {
29412         LDKUserConfig this_ptr_conv;
29413         this_ptr_conv.inner = untag_ptr(this_ptr);
29414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29416         this_ptr_conv.is_owned = false;
29417         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
29418 }
29419
29420 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) {
29421         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
29422         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
29423         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
29424         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
29425         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
29426         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
29427         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
29428         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
29429         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
29430         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
29431         LDKChannelConfig channel_config_arg_conv;
29432         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
29433         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
29434         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
29435         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
29436         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);
29437         uint64_t ret_ref = 0;
29438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29440         return ret_ref;
29441 }
29442
29443 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
29444         LDKUserConfig ret_var = UserConfig_clone(arg);
29445         uint64_t ret_ref = 0;
29446         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29447         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29448         return ret_ref;
29449 }
29450 int64_t  __attribute__((export_name("TS_UserConfig_clone_ptr"))) TS_UserConfig_clone_ptr(uint64_t arg) {
29451         LDKUserConfig arg_conv;
29452         arg_conv.inner = untag_ptr(arg);
29453         arg_conv.is_owned = ptr_is_owned(arg);
29454         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29455         arg_conv.is_owned = false;
29456         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
29457         return ret_conv;
29458 }
29459
29460 uint64_t  __attribute__((export_name("TS_UserConfig_clone"))) TS_UserConfig_clone(uint64_t orig) {
29461         LDKUserConfig orig_conv;
29462         orig_conv.inner = untag_ptr(orig);
29463         orig_conv.is_owned = ptr_is_owned(orig);
29464         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29465         orig_conv.is_owned = false;
29466         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
29467         uint64_t ret_ref = 0;
29468         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29469         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29470         return ret_ref;
29471 }
29472
29473 uint64_t  __attribute__((export_name("TS_UserConfig_default"))) TS_UserConfig_default() {
29474         LDKUserConfig ret_var = UserConfig_default();
29475         uint64_t ret_ref = 0;
29476         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29477         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29478         return ret_ref;
29479 }
29480
29481 void  __attribute__((export_name("TS_BestBlock_free"))) TS_BestBlock_free(uint64_t this_obj) {
29482         LDKBestBlock this_obj_conv;
29483         this_obj_conv.inner = untag_ptr(this_obj);
29484         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29486         BestBlock_free(this_obj_conv);
29487 }
29488
29489 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
29490         LDKBestBlock ret_var = BestBlock_clone(arg);
29491         uint64_t ret_ref = 0;
29492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29494         return ret_ref;
29495 }
29496 int64_t  __attribute__((export_name("TS_BestBlock_clone_ptr"))) TS_BestBlock_clone_ptr(uint64_t arg) {
29497         LDKBestBlock arg_conv;
29498         arg_conv.inner = untag_ptr(arg);
29499         arg_conv.is_owned = ptr_is_owned(arg);
29500         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29501         arg_conv.is_owned = false;
29502         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
29503         return ret_conv;
29504 }
29505
29506 uint64_t  __attribute__((export_name("TS_BestBlock_clone"))) TS_BestBlock_clone(uint64_t orig) {
29507         LDKBestBlock orig_conv;
29508         orig_conv.inner = untag_ptr(orig);
29509         orig_conv.is_owned = ptr_is_owned(orig);
29510         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29511         orig_conv.is_owned = false;
29512         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
29513         uint64_t ret_ref = 0;
29514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29516         return ret_ref;
29517 }
29518
29519 jboolean  __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64_t a, uint64_t b) {
29520         LDKBestBlock a_conv;
29521         a_conv.inner = untag_ptr(a);
29522         a_conv.is_owned = ptr_is_owned(a);
29523         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29524         a_conv.is_owned = false;
29525         LDKBestBlock b_conv;
29526         b_conv.inner = untag_ptr(b);
29527         b_conv.is_owned = ptr_is_owned(b);
29528         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29529         b_conv.is_owned = false;
29530         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
29531         return ret_conv;
29532 }
29533
29534 uint64_t  __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) {
29535         LDKNetwork network_conv = LDKNetwork_from_js(network);
29536         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
29537         uint64_t ret_ref = 0;
29538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29540         return ret_ref;
29541 }
29542
29543 uint64_t  __attribute__((export_name("TS_BestBlock_new"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
29544         LDKThirtyTwoBytes block_hash_ref;
29545         CHECK(block_hash->arr_len == 32);
29546         memcpy(block_hash_ref.data, block_hash->elems, 32); FREE(block_hash);
29547         LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
29548         uint64_t ret_ref = 0;
29549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29551         return ret_ref;
29552 }
29553
29554 int8_tArray  __attribute__((export_name("TS_BestBlock_block_hash"))) TS_BestBlock_block_hash(uint64_t this_arg) {
29555         LDKBestBlock this_arg_conv;
29556         this_arg_conv.inner = untag_ptr(this_arg);
29557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29559         this_arg_conv.is_owned = false;
29560         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
29561         memcpy(ret_arr->elems, BestBlock_block_hash(&this_arg_conv).data, 32);
29562         return ret_arr;
29563 }
29564
29565 int32_t  __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height(uint64_t this_arg) {
29566         LDKBestBlock this_arg_conv;
29567         this_arg_conv.inner = untag_ptr(this_arg);
29568         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29569         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29570         this_arg_conv.is_owned = false;
29571         int32_t ret_conv = BestBlock_height(&this_arg_conv);
29572         return ret_conv;
29573 }
29574
29575 void  __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) {
29576         if (!ptr_is_owned(this_ptr)) return;
29577         void* this_ptr_ptr = untag_ptr(this_ptr);
29578         CHECK_ACCESS(this_ptr_ptr);
29579         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
29580         FREE(untag_ptr(this_ptr));
29581         Listen_free(this_ptr_conv);
29582 }
29583
29584 void  __attribute__((export_name("TS_Confirm_free"))) TS_Confirm_free(uint64_t this_ptr) {
29585         if (!ptr_is_owned(this_ptr)) return;
29586         void* this_ptr_ptr = untag_ptr(this_ptr);
29587         CHECK_ACCESS(this_ptr_ptr);
29588         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
29589         FREE(untag_ptr(this_ptr));
29590         Confirm_free(this_ptr_conv);
29591 }
29592
29593 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_clone"))) TS_ChannelMonitorUpdateStatus_clone(uint64_t orig) {
29594         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
29595         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_clone(orig_conv));
29596         return ret_conv;
29597 }
29598
29599 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_completed"))) TS_ChannelMonitorUpdateStatus_completed() {
29600         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_completed());
29601         return ret_conv;
29602 }
29603
29604 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_in_progress"))) TS_ChannelMonitorUpdateStatus_in_progress() {
29605         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_in_progress());
29606         return ret_conv;
29607 }
29608
29609 uint32_t  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_permanent_failure"))) TS_ChannelMonitorUpdateStatus_permanent_failure() {
29610         uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js(ChannelMonitorUpdateStatus_permanent_failure());
29611         return ret_conv;
29612 }
29613
29614 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdateStatus_eq"))) TS_ChannelMonitorUpdateStatus_eq(uint64_t a, uint64_t b) {
29615         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
29616         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
29617         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
29618         return ret_conv;
29619 }
29620
29621 void  __attribute__((export_name("TS_Watch_free"))) TS_Watch_free(uint64_t this_ptr) {
29622         if (!ptr_is_owned(this_ptr)) return;
29623         void* this_ptr_ptr = untag_ptr(this_ptr);
29624         CHECK_ACCESS(this_ptr_ptr);
29625         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
29626         FREE(untag_ptr(this_ptr));
29627         Watch_free(this_ptr_conv);
29628 }
29629
29630 void  __attribute__((export_name("TS_Filter_free"))) TS_Filter_free(uint64_t this_ptr) {
29631         if (!ptr_is_owned(this_ptr)) return;
29632         void* this_ptr_ptr = untag_ptr(this_ptr);
29633         CHECK_ACCESS(this_ptr_ptr);
29634         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
29635         FREE(untag_ptr(this_ptr));
29636         Filter_free(this_ptr_conv);
29637 }
29638
29639 void  __attribute__((export_name("TS_WatchedOutput_free"))) TS_WatchedOutput_free(uint64_t this_obj) {
29640         LDKWatchedOutput this_obj_conv;
29641         this_obj_conv.inner = untag_ptr(this_obj);
29642         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29644         WatchedOutput_free(this_obj_conv);
29645 }
29646
29647 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_block_hash"))) TS_WatchedOutput_get_block_hash(uint64_t this_ptr) {
29648         LDKWatchedOutput this_ptr_conv;
29649         this_ptr_conv.inner = untag_ptr(this_ptr);
29650         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29652         this_ptr_conv.is_owned = false;
29653         LDKCOption_BlockHashZ *ret_copy = MALLOC(sizeof(LDKCOption_BlockHashZ), "LDKCOption_BlockHashZ");
29654         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
29655         uint64_t ret_ref = tag_ptr(ret_copy, true);
29656         return ret_ref;
29657 }
29658
29659 void  __attribute__((export_name("TS_WatchedOutput_set_block_hash"))) TS_WatchedOutput_set_block_hash(uint64_t this_ptr, uint64_t val) {
29660         LDKWatchedOutput this_ptr_conv;
29661         this_ptr_conv.inner = untag_ptr(this_ptr);
29662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29664         this_ptr_conv.is_owned = false;
29665         void* val_ptr = untag_ptr(val);
29666         CHECK_ACCESS(val_ptr);
29667         LDKCOption_BlockHashZ val_conv = *(LDKCOption_BlockHashZ*)(val_ptr);
29668         val_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(val));
29669         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
29670 }
29671
29672 uint64_t  __attribute__((export_name("TS_WatchedOutput_get_outpoint"))) TS_WatchedOutput_get_outpoint(uint64_t this_ptr) {
29673         LDKWatchedOutput this_ptr_conv;
29674         this_ptr_conv.inner = untag_ptr(this_ptr);
29675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29677         this_ptr_conv.is_owned = false;
29678         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
29679         uint64_t ret_ref = 0;
29680         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29681         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29682         return ret_ref;
29683 }
29684
29685 void  __attribute__((export_name("TS_WatchedOutput_set_outpoint"))) TS_WatchedOutput_set_outpoint(uint64_t this_ptr, uint64_t val) {
29686         LDKWatchedOutput this_ptr_conv;
29687         this_ptr_conv.inner = untag_ptr(this_ptr);
29688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29690         this_ptr_conv.is_owned = false;
29691         LDKOutPoint val_conv;
29692         val_conv.inner = untag_ptr(val);
29693         val_conv.is_owned = ptr_is_owned(val);
29694         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
29695         val_conv = OutPoint_clone(&val_conv);
29696         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
29697 }
29698
29699 int8_tArray  __attribute__((export_name("TS_WatchedOutput_get_script_pubkey"))) TS_WatchedOutput_get_script_pubkey(uint64_t this_ptr) {
29700         LDKWatchedOutput this_ptr_conv;
29701         this_ptr_conv.inner = untag_ptr(this_ptr);
29702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29704         this_ptr_conv.is_owned = false;
29705         LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
29706         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
29707         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
29708         return ret_arr;
29709 }
29710
29711 void  __attribute__((export_name("TS_WatchedOutput_set_script_pubkey"))) TS_WatchedOutput_set_script_pubkey(uint64_t this_ptr, int8_tArray val) {
29712         LDKWatchedOutput this_ptr_conv;
29713         this_ptr_conv.inner = untag_ptr(this_ptr);
29714         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
29715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
29716         this_ptr_conv.is_owned = false;
29717         LDKCVec_u8Z val_ref;
29718         val_ref.datalen = val->arr_len;
29719         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
29720         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
29721         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
29722 }
29723
29724 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) {
29725         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
29726         CHECK_ACCESS(block_hash_arg_ptr);
29727         LDKCOption_BlockHashZ block_hash_arg_conv = *(LDKCOption_BlockHashZ*)(block_hash_arg_ptr);
29728         block_hash_arg_conv = COption_BlockHashZ_clone((LDKCOption_BlockHashZ*)untag_ptr(block_hash_arg));
29729         LDKOutPoint outpoint_arg_conv;
29730         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
29731         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
29732         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
29733         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
29734         LDKCVec_u8Z script_pubkey_arg_ref;
29735         script_pubkey_arg_ref.datalen = script_pubkey_arg->arr_len;
29736         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
29737         memcpy(script_pubkey_arg_ref.data, script_pubkey_arg->elems, script_pubkey_arg_ref.datalen); FREE(script_pubkey_arg);
29738         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
29739         uint64_t ret_ref = 0;
29740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29742         return ret_ref;
29743 }
29744
29745 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
29746         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
29747         uint64_t ret_ref = 0;
29748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29750         return ret_ref;
29751 }
29752 int64_t  __attribute__((export_name("TS_WatchedOutput_clone_ptr"))) TS_WatchedOutput_clone_ptr(uint64_t arg) {
29753         LDKWatchedOutput arg_conv;
29754         arg_conv.inner = untag_ptr(arg);
29755         arg_conv.is_owned = ptr_is_owned(arg);
29756         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29757         arg_conv.is_owned = false;
29758         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
29759         return ret_conv;
29760 }
29761
29762 uint64_t  __attribute__((export_name("TS_WatchedOutput_clone"))) TS_WatchedOutput_clone(uint64_t orig) {
29763         LDKWatchedOutput orig_conv;
29764         orig_conv.inner = untag_ptr(orig);
29765         orig_conv.is_owned = ptr_is_owned(orig);
29766         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29767         orig_conv.is_owned = false;
29768         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
29769         uint64_t ret_ref = 0;
29770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29772         return ret_ref;
29773 }
29774
29775 jboolean  __attribute__((export_name("TS_WatchedOutput_eq"))) TS_WatchedOutput_eq(uint64_t a, uint64_t b) {
29776         LDKWatchedOutput a_conv;
29777         a_conv.inner = untag_ptr(a);
29778         a_conv.is_owned = ptr_is_owned(a);
29779         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29780         a_conv.is_owned = false;
29781         LDKWatchedOutput b_conv;
29782         b_conv.inner = untag_ptr(b);
29783         b_conv.is_owned = ptr_is_owned(b);
29784         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29785         b_conv.is_owned = false;
29786         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
29787         return ret_conv;
29788 }
29789
29790 int64_t  __attribute__((export_name("TS_WatchedOutput_hash"))) TS_WatchedOutput_hash(uint64_t o) {
29791         LDKWatchedOutput o_conv;
29792         o_conv.inner = untag_ptr(o);
29793         o_conv.is_owned = ptr_is_owned(o);
29794         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29795         o_conv.is_owned = false;
29796         int64_t ret_conv = WatchedOutput_hash(&o_conv);
29797         return ret_conv;
29798 }
29799
29800 void  __attribute__((export_name("TS_BroadcasterInterface_free"))) TS_BroadcasterInterface_free(uint64_t this_ptr) {
29801         if (!ptr_is_owned(this_ptr)) return;
29802         void* this_ptr_ptr = untag_ptr(this_ptr);
29803         CHECK_ACCESS(this_ptr_ptr);
29804         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
29805         FREE(untag_ptr(this_ptr));
29806         BroadcasterInterface_free(this_ptr_conv);
29807 }
29808
29809 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_clone"))) TS_ConfirmationTarget_clone(uint64_t orig) {
29810         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
29811         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_clone(orig_conv));
29812         return ret_conv;
29813 }
29814
29815 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_mempool_minimum"))) TS_ConfirmationTarget_mempool_minimum() {
29816         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_mempool_minimum());
29817         return ret_conv;
29818 }
29819
29820 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_background"))) TS_ConfirmationTarget_background() {
29821         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_background());
29822         return ret_conv;
29823 }
29824
29825 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_normal"))) TS_ConfirmationTarget_normal() {
29826         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_normal());
29827         return ret_conv;
29828 }
29829
29830 uint32_t  __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS_ConfirmationTarget_high_priority() {
29831         uint32_t ret_conv = LDKConfirmationTarget_to_js(ConfirmationTarget_high_priority());
29832         return ret_conv;
29833 }
29834
29835 int64_t  __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) {
29836         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
29837         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
29838         return ret_conv;
29839 }
29840
29841 jboolean  __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) {
29842         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
29843         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
29844         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
29845         return ret_conv;
29846 }
29847
29848 void  __attribute__((export_name("TS_FeeEstimator_free"))) TS_FeeEstimator_free(uint64_t this_ptr) {
29849         if (!ptr_is_owned(this_ptr)) return;
29850         void* this_ptr_ptr = untag_ptr(this_ptr);
29851         CHECK_ACCESS(this_ptr_ptr);
29852         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
29853         FREE(untag_ptr(this_ptr));
29854         FeeEstimator_free(this_ptr_conv);
29855 }
29856
29857 void  __attribute__((export_name("TS_MonitorUpdateId_free"))) TS_MonitorUpdateId_free(uint64_t this_obj) {
29858         LDKMonitorUpdateId this_obj_conv;
29859         this_obj_conv.inner = untag_ptr(this_obj);
29860         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29862         MonitorUpdateId_free(this_obj_conv);
29863 }
29864
29865 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
29866         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
29867         uint64_t ret_ref = 0;
29868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29870         return ret_ref;
29871 }
29872 int64_t  __attribute__((export_name("TS_MonitorUpdateId_clone_ptr"))) TS_MonitorUpdateId_clone_ptr(uint64_t arg) {
29873         LDKMonitorUpdateId arg_conv;
29874         arg_conv.inner = untag_ptr(arg);
29875         arg_conv.is_owned = ptr_is_owned(arg);
29876         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
29877         arg_conv.is_owned = false;
29878         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
29879         return ret_conv;
29880 }
29881
29882 uint64_t  __attribute__((export_name("TS_MonitorUpdateId_clone"))) TS_MonitorUpdateId_clone(uint64_t orig) {
29883         LDKMonitorUpdateId orig_conv;
29884         orig_conv.inner = untag_ptr(orig);
29885         orig_conv.is_owned = ptr_is_owned(orig);
29886         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
29887         orig_conv.is_owned = false;
29888         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
29889         uint64_t ret_ref = 0;
29890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29892         return ret_ref;
29893 }
29894
29895 int64_t  __attribute__((export_name("TS_MonitorUpdateId_hash"))) TS_MonitorUpdateId_hash(uint64_t o) {
29896         LDKMonitorUpdateId o_conv;
29897         o_conv.inner = untag_ptr(o);
29898         o_conv.is_owned = ptr_is_owned(o);
29899         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29900         o_conv.is_owned = false;
29901         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
29902         return ret_conv;
29903 }
29904
29905 jboolean  __attribute__((export_name("TS_MonitorUpdateId_eq"))) TS_MonitorUpdateId_eq(uint64_t a, uint64_t b) {
29906         LDKMonitorUpdateId a_conv;
29907         a_conv.inner = untag_ptr(a);
29908         a_conv.is_owned = ptr_is_owned(a);
29909         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
29910         a_conv.is_owned = false;
29911         LDKMonitorUpdateId b_conv;
29912         b_conv.inner = untag_ptr(b);
29913         b_conv.is_owned = ptr_is_owned(b);
29914         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
29915         b_conv.is_owned = false;
29916         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
29917         return ret_conv;
29918 }
29919
29920 void  __attribute__((export_name("TS_Persist_free"))) TS_Persist_free(uint64_t this_ptr) {
29921         if (!ptr_is_owned(this_ptr)) return;
29922         void* this_ptr_ptr = untag_ptr(this_ptr);
29923         CHECK_ACCESS(this_ptr_ptr);
29924         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
29925         FREE(untag_ptr(this_ptr));
29926         Persist_free(this_ptr_conv);
29927 }
29928
29929 void  __attribute__((export_name("TS_LockedChannelMonitor_free"))) TS_LockedChannelMonitor_free(uint64_t this_obj) {
29930         LDKLockedChannelMonitor this_obj_conv;
29931         this_obj_conv.inner = untag_ptr(this_obj);
29932         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29934         LockedChannelMonitor_free(this_obj_conv);
29935 }
29936
29937 void  __attribute__((export_name("TS_ChainMonitor_free"))) TS_ChainMonitor_free(uint64_t this_obj) {
29938         LDKChainMonitor this_obj_conv;
29939         this_obj_conv.inner = untag_ptr(this_obj);
29940         this_obj_conv.is_owned = ptr_is_owned(this_obj);
29941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
29942         ChainMonitor_free(this_obj_conv);
29943 }
29944
29945 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) {
29946         void* chain_source_ptr = untag_ptr(chain_source);
29947         CHECK_ACCESS(chain_source_ptr);
29948         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
29949         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
29950         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
29951                 // Manually implement clone for Java trait instances
29952                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
29953                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29954                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
29955                 }
29956         }
29957         void* broadcaster_ptr = untag_ptr(broadcaster);
29958         CHECK_ACCESS(broadcaster_ptr);
29959         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
29960         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
29961                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29962                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
29963         }
29964         void* logger_ptr = untag_ptr(logger);
29965         CHECK_ACCESS(logger_ptr);
29966         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
29967         if (logger_conv.free == LDKLogger_JCalls_free) {
29968                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29969                 LDKLogger_JCalls_cloned(&logger_conv);
29970         }
29971         void* feeest_ptr = untag_ptr(feeest);
29972         CHECK_ACCESS(feeest_ptr);
29973         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
29974         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
29975                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29976                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
29977         }
29978         void* persister_ptr = untag_ptr(persister);
29979         CHECK_ACCESS(persister_ptr);
29980         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
29981         if (persister_conv.free == LDKPersist_JCalls_free) {
29982                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
29983                 LDKPersist_JCalls_cloned(&persister_conv);
29984         }
29985         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
29986         uint64_t ret_ref = 0;
29987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
29988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
29989         return ret_ref;
29990 }
29991
29992 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_get_claimable_balances"))) TS_ChainMonitor_get_claimable_balances(uint64_t this_arg, uint64_tArray ignored_channels) {
29993         LDKChainMonitor this_arg_conv;
29994         this_arg_conv.inner = untag_ptr(this_arg);
29995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
29996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
29997         this_arg_conv.is_owned = false;
29998         LDKCVec_ChannelDetailsZ ignored_channels_constr;
29999         ignored_channels_constr.datalen = ignored_channels->arr_len;
30000         if (ignored_channels_constr.datalen > 0)
30001                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
30002         else
30003                 ignored_channels_constr.data = NULL;
30004         uint64_t* ignored_channels_vals = ignored_channels->elems;
30005         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
30006                 uint64_t ignored_channels_conv_16 = ignored_channels_vals[q];
30007                 LDKChannelDetails ignored_channels_conv_16_conv;
30008                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
30009                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
30010                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
30011                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
30012                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
30013         }
30014         FREE(ignored_channels);
30015         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
30016         uint64_tArray ret_arr = NULL;
30017         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30018         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30019         for (size_t j = 0; j < ret_var.datalen; j++) {
30020                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30021                 *ret_conv_9_copy = ret_var.data[j];
30022                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
30023                 ret_arr_ptr[j] = ret_conv_9_ref;
30024         }
30025         
30026         FREE(ret_var.data);
30027         return ret_arr;
30028 }
30029
30030 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_monitor"))) TS_ChainMonitor_get_monitor(uint64_t this_arg, uint64_t funding_txo) {
30031         LDKChainMonitor this_arg_conv;
30032         this_arg_conv.inner = untag_ptr(this_arg);
30033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30035         this_arg_conv.is_owned = false;
30036         LDKOutPoint funding_txo_conv;
30037         funding_txo_conv.inner = untag_ptr(funding_txo);
30038         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
30039         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
30040         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
30041         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
30042         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
30043         return tag_ptr(ret_conv, true);
30044 }
30045
30046 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ChainMonitor_list_monitors(uint64_t this_arg) {
30047         LDKChainMonitor this_arg_conv;
30048         this_arg_conv.inner = untag_ptr(this_arg);
30049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30051         this_arg_conv.is_owned = false;
30052         LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
30053         uint64_tArray ret_arr = NULL;
30054         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30055         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30056         for (size_t k = 0; k < ret_var.datalen; k++) {
30057                 LDKOutPoint ret_conv_10_var = ret_var.data[k];
30058                 uint64_t ret_conv_10_ref = 0;
30059                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
30060                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
30061                 ret_arr_ptr[k] = ret_conv_10_ref;
30062         }
30063         
30064         FREE(ret_var.data);
30065         return ret_arr;
30066 }
30067
30068 uint64_tArray  __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) {
30069         LDKChainMonitor this_arg_conv;
30070         this_arg_conv.inner = untag_ptr(this_arg);
30071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30073         this_arg_conv.is_owned = false;
30074         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
30075         uint64_tArray ret_arr = NULL;
30076         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30077         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30078         for (size_t p = 0; p < ret_var.datalen; p++) {
30079                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
30080                 *ret_conv_41_conv = ret_var.data[p];
30081                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
30082         }
30083         
30084         FREE(ret_var.data);
30085         return ret_arr;
30086 }
30087
30088 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) {
30089         LDKChainMonitor this_arg_conv;
30090         this_arg_conv.inner = untag_ptr(this_arg);
30091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30093         this_arg_conv.is_owned = false;
30094         LDKOutPoint funding_txo_conv;
30095         funding_txo_conv.inner = untag_ptr(funding_txo);
30096         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
30097         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
30098         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
30099         LDKMonitorUpdateId completed_update_id_conv;
30100         completed_update_id_conv.inner = untag_ptr(completed_update_id);
30101         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
30102         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
30103         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
30104         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
30105         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
30106         return tag_ptr(ret_conv, true);
30107 }
30108
30109 uint64_t  __attribute__((export_name("TS_ChainMonitor_get_update_future"))) TS_ChainMonitor_get_update_future(uint64_t this_arg) {
30110         LDKChainMonitor this_arg_conv;
30111         this_arg_conv.inner = untag_ptr(this_arg);
30112         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30114         this_arg_conv.is_owned = false;
30115         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
30116         uint64_t ret_ref = 0;
30117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30119         return ret_ref;
30120 }
30121
30122 void  __attribute__((export_name("TS_ChainMonitor_rebroadcast_pending_claims"))) TS_ChainMonitor_rebroadcast_pending_claims(uint64_t this_arg) {
30123         LDKChainMonitor this_arg_conv;
30124         this_arg_conv.inner = untag_ptr(this_arg);
30125         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30127         this_arg_conv.is_owned = false;
30128         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
30129 }
30130
30131 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Listen"))) TS_ChainMonitor_as_Listen(uint64_t this_arg) {
30132         LDKChainMonitor this_arg_conv;
30133         this_arg_conv.inner = untag_ptr(this_arg);
30134         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30136         this_arg_conv.is_owned = false;
30137         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
30138         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
30139         return tag_ptr(ret_ret, true);
30140 }
30141
30142 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Confirm"))) TS_ChainMonitor_as_Confirm(uint64_t this_arg) {
30143         LDKChainMonitor this_arg_conv;
30144         this_arg_conv.inner = untag_ptr(this_arg);
30145         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30147         this_arg_conv.is_owned = false;
30148         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
30149         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
30150         return tag_ptr(ret_ret, true);
30151 }
30152
30153 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_Watch"))) TS_ChainMonitor_as_Watch(uint64_t this_arg) {
30154         LDKChainMonitor this_arg_conv;
30155         this_arg_conv.inner = untag_ptr(this_arg);
30156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30158         this_arg_conv.is_owned = false;
30159         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
30160         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
30161         return tag_ptr(ret_ret, true);
30162 }
30163
30164 uint64_t  __attribute__((export_name("TS_ChainMonitor_as_EventsProvider"))) TS_ChainMonitor_as_EventsProvider(uint64_t this_arg) {
30165         LDKChainMonitor this_arg_conv;
30166         this_arg_conv.inner = untag_ptr(this_arg);
30167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30169         this_arg_conv.is_owned = false;
30170         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
30171         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
30172         return tag_ptr(ret_ret, true);
30173 }
30174
30175 void  __attribute__((export_name("TS_ChannelMonitorUpdate_free"))) TS_ChannelMonitorUpdate_free(uint64_t this_obj) {
30176         LDKChannelMonitorUpdate this_obj_conv;
30177         this_obj_conv.inner = untag_ptr(this_obj);
30178         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30180         ChannelMonitorUpdate_free(this_obj_conv);
30181 }
30182
30183 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_get_update_id"))) TS_ChannelMonitorUpdate_get_update_id(uint64_t this_ptr) {
30184         LDKChannelMonitorUpdate this_ptr_conv;
30185         this_ptr_conv.inner = untag_ptr(this_ptr);
30186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30188         this_ptr_conv.is_owned = false;
30189         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
30190         return ret_conv;
30191 }
30192
30193 void  __attribute__((export_name("TS_ChannelMonitorUpdate_set_update_id"))) TS_ChannelMonitorUpdate_set_update_id(uint64_t this_ptr, int64_t val) {
30194         LDKChannelMonitorUpdate this_ptr_conv;
30195         this_ptr_conv.inner = untag_ptr(this_ptr);
30196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
30197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
30198         this_ptr_conv.is_owned = false;
30199         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
30200 }
30201
30202 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
30203         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
30204         uint64_t ret_ref = 0;
30205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30207         return ret_ref;
30208 }
30209 int64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone_ptr"))) TS_ChannelMonitorUpdate_clone_ptr(uint64_t arg) {
30210         LDKChannelMonitorUpdate arg_conv;
30211         arg_conv.inner = untag_ptr(arg);
30212         arg_conv.is_owned = ptr_is_owned(arg);
30213         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30214         arg_conv.is_owned = false;
30215         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
30216         return ret_conv;
30217 }
30218
30219 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_clone"))) TS_ChannelMonitorUpdate_clone(uint64_t orig) {
30220         LDKChannelMonitorUpdate orig_conv;
30221         orig_conv.inner = untag_ptr(orig);
30222         orig_conv.is_owned = ptr_is_owned(orig);
30223         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30224         orig_conv.is_owned = false;
30225         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
30226         uint64_t ret_ref = 0;
30227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30229         return ret_ref;
30230 }
30231
30232 jboolean  __attribute__((export_name("TS_ChannelMonitorUpdate_eq"))) TS_ChannelMonitorUpdate_eq(uint64_t a, uint64_t b) {
30233         LDKChannelMonitorUpdate a_conv;
30234         a_conv.inner = untag_ptr(a);
30235         a_conv.is_owned = ptr_is_owned(a);
30236         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30237         a_conv.is_owned = false;
30238         LDKChannelMonitorUpdate b_conv;
30239         b_conv.inner = untag_ptr(b);
30240         b_conv.is_owned = ptr_is_owned(b);
30241         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30242         b_conv.is_owned = false;
30243         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
30244         return ret_conv;
30245 }
30246
30247 int8_tArray  __attribute__((export_name("TS_ChannelMonitorUpdate_write"))) TS_ChannelMonitorUpdate_write(uint64_t obj) {
30248         LDKChannelMonitorUpdate obj_conv;
30249         obj_conv.inner = untag_ptr(obj);
30250         obj_conv.is_owned = ptr_is_owned(obj);
30251         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30252         obj_conv.is_owned = false;
30253         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
30254         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30255         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30256         CVec_u8Z_free(ret_var);
30257         return ret_arr;
30258 }
30259
30260 uint64_t  __attribute__((export_name("TS_ChannelMonitorUpdate_read"))) TS_ChannelMonitorUpdate_read(int8_tArray ser) {
30261         LDKu8slice ser_ref;
30262         ser_ref.datalen = ser->arr_len;
30263         ser_ref.data = ser->elems;
30264         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
30265         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
30266         FREE(ser);
30267         return tag_ptr(ret_conv, true);
30268 }
30269
30270 void  __attribute__((export_name("TS_MonitorEvent_free"))) TS_MonitorEvent_free(uint64_t this_ptr) {
30271         if (!ptr_is_owned(this_ptr)) return;
30272         void* this_ptr_ptr = untag_ptr(this_ptr);
30273         CHECK_ACCESS(this_ptr_ptr);
30274         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
30275         FREE(untag_ptr(this_ptr));
30276         MonitorEvent_free(this_ptr_conv);
30277 }
30278
30279 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
30280         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30281         *ret_copy = MonitorEvent_clone(arg);
30282         uint64_t ret_ref = tag_ptr(ret_copy, true);
30283         return ret_ref;
30284 }
30285 int64_t  __attribute__((export_name("TS_MonitorEvent_clone_ptr"))) TS_MonitorEvent_clone_ptr(uint64_t arg) {
30286         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
30287         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
30288         return ret_conv;
30289 }
30290
30291 uint64_t  __attribute__((export_name("TS_MonitorEvent_clone"))) TS_MonitorEvent_clone(uint64_t orig) {
30292         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
30293         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30294         *ret_copy = MonitorEvent_clone(orig_conv);
30295         uint64_t ret_ref = tag_ptr(ret_copy, true);
30296         return ret_ref;
30297 }
30298
30299 uint64_t  __attribute__((export_name("TS_MonitorEvent_htlcevent"))) TS_MonitorEvent_htlcevent(uint64_t a) {
30300         LDKHTLCUpdate a_conv;
30301         a_conv.inner = untag_ptr(a);
30302         a_conv.is_owned = ptr_is_owned(a);
30303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30304         a_conv = HTLCUpdate_clone(&a_conv);
30305         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30306         *ret_copy = MonitorEvent_htlcevent(a_conv);
30307         uint64_t ret_ref = tag_ptr(ret_copy, true);
30308         return ret_ref;
30309 }
30310
30311 uint64_t  __attribute__((export_name("TS_MonitorEvent_commitment_tx_confirmed"))) TS_MonitorEvent_commitment_tx_confirmed(uint64_t a) {
30312         LDKOutPoint a_conv;
30313         a_conv.inner = untag_ptr(a);
30314         a_conv.is_owned = ptr_is_owned(a);
30315         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30316         a_conv = OutPoint_clone(&a_conv);
30317         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30318         *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
30319         uint64_t ret_ref = tag_ptr(ret_copy, true);
30320         return ret_ref;
30321 }
30322
30323 uint64_t  __attribute__((export_name("TS_MonitorEvent_completed"))) TS_MonitorEvent_completed(uint64_t funding_txo, int64_t monitor_update_id) {
30324         LDKOutPoint funding_txo_conv;
30325         funding_txo_conv.inner = untag_ptr(funding_txo);
30326         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
30327         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
30328         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
30329         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30330         *ret_copy = MonitorEvent_completed(funding_txo_conv, monitor_update_id);
30331         uint64_t ret_ref = tag_ptr(ret_copy, true);
30332         return ret_ref;
30333 }
30334
30335 uint64_t  __attribute__((export_name("TS_MonitorEvent_update_failed"))) TS_MonitorEvent_update_failed(uint64_t a) {
30336         LDKOutPoint a_conv;
30337         a_conv.inner = untag_ptr(a);
30338         a_conv.is_owned = ptr_is_owned(a);
30339         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30340         a_conv = OutPoint_clone(&a_conv);
30341         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30342         *ret_copy = MonitorEvent_update_failed(a_conv);
30343         uint64_t ret_ref = tag_ptr(ret_copy, true);
30344         return ret_ref;
30345 }
30346
30347 jboolean  __attribute__((export_name("TS_MonitorEvent_eq"))) TS_MonitorEvent_eq(uint64_t a, uint64_t b) {
30348         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
30349         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
30350         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
30351         return ret_conv;
30352 }
30353
30354 int8_tArray  __attribute__((export_name("TS_MonitorEvent_write"))) TS_MonitorEvent_write(uint64_t obj) {
30355         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
30356         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
30357         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30358         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30359         CVec_u8Z_free(ret_var);
30360         return ret_arr;
30361 }
30362
30363 uint64_t  __attribute__((export_name("TS_MonitorEvent_read"))) TS_MonitorEvent_read(int8_tArray ser) {
30364         LDKu8slice ser_ref;
30365         ser_ref.datalen = ser->arr_len;
30366         ser_ref.data = ser->elems;
30367         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
30368         *ret_conv = MonitorEvent_read(ser_ref);
30369         FREE(ser);
30370         return tag_ptr(ret_conv, true);
30371 }
30372
30373 void  __attribute__((export_name("TS_HTLCUpdate_free"))) TS_HTLCUpdate_free(uint64_t this_obj) {
30374         LDKHTLCUpdate this_obj_conv;
30375         this_obj_conv.inner = untag_ptr(this_obj);
30376         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30378         HTLCUpdate_free(this_obj_conv);
30379 }
30380
30381 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
30382         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
30383         uint64_t ret_ref = 0;
30384         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30385         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30386         return ret_ref;
30387 }
30388 int64_t  __attribute__((export_name("TS_HTLCUpdate_clone_ptr"))) TS_HTLCUpdate_clone_ptr(uint64_t arg) {
30389         LDKHTLCUpdate arg_conv;
30390         arg_conv.inner = untag_ptr(arg);
30391         arg_conv.is_owned = ptr_is_owned(arg);
30392         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30393         arg_conv.is_owned = false;
30394         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
30395         return ret_conv;
30396 }
30397
30398 uint64_t  __attribute__((export_name("TS_HTLCUpdate_clone"))) TS_HTLCUpdate_clone(uint64_t orig) {
30399         LDKHTLCUpdate orig_conv;
30400         orig_conv.inner = untag_ptr(orig);
30401         orig_conv.is_owned = ptr_is_owned(orig);
30402         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30403         orig_conv.is_owned = false;
30404         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
30405         uint64_t ret_ref = 0;
30406         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30407         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30408         return ret_ref;
30409 }
30410
30411 jboolean  __attribute__((export_name("TS_HTLCUpdate_eq"))) TS_HTLCUpdate_eq(uint64_t a, uint64_t b) {
30412         LDKHTLCUpdate a_conv;
30413         a_conv.inner = untag_ptr(a);
30414         a_conv.is_owned = ptr_is_owned(a);
30415         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30416         a_conv.is_owned = false;
30417         LDKHTLCUpdate b_conv;
30418         b_conv.inner = untag_ptr(b);
30419         b_conv.is_owned = ptr_is_owned(b);
30420         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
30421         b_conv.is_owned = false;
30422         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
30423         return ret_conv;
30424 }
30425
30426 int8_tArray  __attribute__((export_name("TS_HTLCUpdate_write"))) TS_HTLCUpdate_write(uint64_t obj) {
30427         LDKHTLCUpdate obj_conv;
30428         obj_conv.inner = untag_ptr(obj);
30429         obj_conv.is_owned = ptr_is_owned(obj);
30430         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30431         obj_conv.is_owned = false;
30432         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
30433         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30434         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30435         CVec_u8Z_free(ret_var);
30436         return ret_arr;
30437 }
30438
30439 uint64_t  __attribute__((export_name("TS_HTLCUpdate_read"))) TS_HTLCUpdate_read(int8_tArray ser) {
30440         LDKu8slice ser_ref;
30441         ser_ref.datalen = ser->arr_len;
30442         ser_ref.data = ser->elems;
30443         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
30444         *ret_conv = HTLCUpdate_read(ser_ref);
30445         FREE(ser);
30446         return tag_ptr(ret_conv, true);
30447 }
30448
30449 void  __attribute__((export_name("TS_Balance_free"))) TS_Balance_free(uint64_t this_ptr) {
30450         if (!ptr_is_owned(this_ptr)) return;
30451         void* this_ptr_ptr = untag_ptr(this_ptr);
30452         CHECK_ACCESS(this_ptr_ptr);
30453         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
30454         FREE(untag_ptr(this_ptr));
30455         Balance_free(this_ptr_conv);
30456 }
30457
30458 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
30459         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30460         *ret_copy = Balance_clone(arg);
30461         uint64_t ret_ref = tag_ptr(ret_copy, true);
30462         return ret_ref;
30463 }
30464 int64_t  __attribute__((export_name("TS_Balance_clone_ptr"))) TS_Balance_clone_ptr(uint64_t arg) {
30465         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
30466         int64_t ret_conv = Balance_clone_ptr(arg_conv);
30467         return ret_conv;
30468 }
30469
30470 uint64_t  __attribute__((export_name("TS_Balance_clone"))) TS_Balance_clone(uint64_t orig) {
30471         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
30472         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30473         *ret_copy = Balance_clone(orig_conv);
30474         uint64_t ret_ref = tag_ptr(ret_copy, true);
30475         return ret_ref;
30476 }
30477
30478 uint64_t  __attribute__((export_name("TS_Balance_claimable_on_channel_close"))) TS_Balance_claimable_on_channel_close(int64_t amount_satoshis) {
30479         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30480         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
30481         uint64_t ret_ref = tag_ptr(ret_copy, true);
30482         return ret_ref;
30483 }
30484
30485 uint64_t  __attribute__((export_name("TS_Balance_claimable_awaiting_confirmations"))) TS_Balance_claimable_awaiting_confirmations(int64_t amount_satoshis, int32_t confirmation_height) {
30486         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30487         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
30488         uint64_t ret_ref = tag_ptr(ret_copy, true);
30489         return ret_ref;
30490 }
30491
30492 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) {
30493         LDKThirtyTwoBytes payment_hash_ref;
30494         CHECK(payment_hash->arr_len == 32);
30495         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30496         LDKThirtyTwoBytes payment_preimage_ref;
30497         CHECK(payment_preimage->arr_len == 32);
30498         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
30499         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30500         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
30501         uint64_t ret_ref = tag_ptr(ret_copy, true);
30502         return ret_ref;
30503 }
30504
30505 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) {
30506         LDKThirtyTwoBytes payment_hash_ref;
30507         CHECK(payment_hash->arr_len == 32);
30508         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30509         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30510         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
30511         uint64_t ret_ref = tag_ptr(ret_copy, true);
30512         return ret_ref;
30513 }
30514
30515 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) {
30516         LDKThirtyTwoBytes payment_hash_ref;
30517         CHECK(payment_hash->arr_len == 32);
30518         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
30519         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30520         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
30521         uint64_t ret_ref = tag_ptr(ret_copy, true);
30522         return ret_ref;
30523 }
30524
30525 uint64_t  __attribute__((export_name("TS_Balance_counterparty_revoked_output_claimable"))) TS_Balance_counterparty_revoked_output_claimable(int64_t amount_satoshis) {
30526         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
30527         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
30528         uint64_t ret_ref = tag_ptr(ret_copy, true);
30529         return ret_ref;
30530 }
30531
30532 jboolean  __attribute__((export_name("TS_Balance_eq"))) TS_Balance_eq(uint64_t a, uint64_t b) {
30533         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
30534         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
30535         jboolean ret_conv = Balance_eq(a_conv, b_conv);
30536         return ret_conv;
30537 }
30538
30539 int64_t  __attribute__((export_name("TS_Balance_claimable_amount_satoshis"))) TS_Balance_claimable_amount_satoshis(uint64_t this_arg) {
30540         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
30541         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
30542         return ret_conv;
30543 }
30544
30545 void  __attribute__((export_name("TS_ChannelMonitor_free"))) TS_ChannelMonitor_free(uint64_t this_obj) {
30546         LDKChannelMonitor this_obj_conv;
30547         this_obj_conv.inner = untag_ptr(this_obj);
30548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
30549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
30550         ChannelMonitor_free(this_obj_conv);
30551 }
30552
30553 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
30554         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
30555         uint64_t ret_ref = 0;
30556         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30557         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30558         return ret_ref;
30559 }
30560 int64_t  __attribute__((export_name("TS_ChannelMonitor_clone_ptr"))) TS_ChannelMonitor_clone_ptr(uint64_t arg) {
30561         LDKChannelMonitor arg_conv;
30562         arg_conv.inner = untag_ptr(arg);
30563         arg_conv.is_owned = ptr_is_owned(arg);
30564         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
30565         arg_conv.is_owned = false;
30566         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
30567         return ret_conv;
30568 }
30569
30570 uint64_t  __attribute__((export_name("TS_ChannelMonitor_clone"))) TS_ChannelMonitor_clone(uint64_t orig) {
30571         LDKChannelMonitor orig_conv;
30572         orig_conv.inner = untag_ptr(orig);
30573         orig_conv.is_owned = ptr_is_owned(orig);
30574         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
30575         orig_conv.is_owned = false;
30576         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
30577         uint64_t ret_ref = 0;
30578         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
30579         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
30580         return ret_ref;
30581 }
30582
30583 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_write"))) TS_ChannelMonitor_write(uint64_t obj) {
30584         LDKChannelMonitor obj_conv;
30585         obj_conv.inner = untag_ptr(obj);
30586         obj_conv.is_owned = ptr_is_owned(obj);
30587         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
30588         obj_conv.is_owned = false;
30589         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
30590         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
30591         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
30592         CVec_u8Z_free(ret_var);
30593         return ret_arr;
30594 }
30595
30596 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) {
30597         LDKChannelMonitor this_arg_conv;
30598         this_arg_conv.inner = untag_ptr(this_arg);
30599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30601         this_arg_conv.is_owned = false;
30602         LDKChannelMonitorUpdate updates_conv;
30603         updates_conv.inner = untag_ptr(updates);
30604         updates_conv.is_owned = ptr_is_owned(updates);
30605         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
30606         updates_conv.is_owned = false;
30607         void* broadcaster_ptr = untag_ptr(broadcaster);
30608         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
30609         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
30610         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30611         CHECK_ACCESS(fee_estimator_ptr);
30612         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30613         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30614                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30615                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30616         }
30617         void* logger_ptr = untag_ptr(logger);
30618         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
30619         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
30620         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
30621         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
30622         return tag_ptr(ret_conv, true);
30623 }
30624
30625 int64_t  __attribute__((export_name("TS_ChannelMonitor_get_latest_update_id"))) TS_ChannelMonitor_get_latest_update_id(uint64_t this_arg) {
30626         LDKChannelMonitor this_arg_conv;
30627         this_arg_conv.inner = untag_ptr(this_arg);
30628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30630         this_arg_conv.is_owned = false;
30631         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
30632         return ret_conv;
30633 }
30634
30635 uint64_t  __attribute__((export_name("TS_ChannelMonitor_get_funding_txo"))) TS_ChannelMonitor_get_funding_txo(uint64_t this_arg) {
30636         LDKChannelMonitor this_arg_conv;
30637         this_arg_conv.inner = untag_ptr(this_arg);
30638         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30640         this_arg_conv.is_owned = false;
30641         LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
30642         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
30643         return tag_ptr(ret_conv, true);
30644 }
30645
30646 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_outputs_to_watch"))) TS_ChannelMonitor_get_outputs_to_watch(uint64_t this_arg) {
30647         LDKChannelMonitor this_arg_conv;
30648         this_arg_conv.inner = untag_ptr(this_arg);
30649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30651         this_arg_conv.is_owned = false;
30652         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
30653         uint64_tArray ret_arr = NULL;
30654         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30655         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30656         for (size_t o = 0; o < ret_var.datalen; o++) {
30657                 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
30658                 *ret_conv_40_conv = ret_var.data[o];
30659                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
30660         }
30661         
30662         FREE(ret_var.data);
30663         return ret_arr;
30664 }
30665
30666 void  __attribute__((export_name("TS_ChannelMonitor_load_outputs_to_watch"))) TS_ChannelMonitor_load_outputs_to_watch(uint64_t this_arg, uint64_t filter) {
30667         LDKChannelMonitor this_arg_conv;
30668         this_arg_conv.inner = untag_ptr(this_arg);
30669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30671         this_arg_conv.is_owned = false;
30672         void* filter_ptr = untag_ptr(filter);
30673         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
30674         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
30675         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
30676 }
30677
30678 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) {
30679         LDKChannelMonitor this_arg_conv;
30680         this_arg_conv.inner = untag_ptr(this_arg);
30681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30683         this_arg_conv.is_owned = false;
30684         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
30685         uint64_tArray ret_arr = NULL;
30686         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30687         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30688         for (size_t o = 0; o < ret_var.datalen; o++) {
30689                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
30690                 *ret_conv_14_copy = ret_var.data[o];
30691                 uint64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
30692                 ret_arr_ptr[o] = ret_conv_14_ref;
30693         }
30694         
30695         FREE(ret_var.data);
30696         return ret_arr;
30697 }
30698
30699 void  __attribute__((export_name("TS_ChannelMonitor_process_pending_events"))) TS_ChannelMonitor_process_pending_events(uint64_t this_arg, uint64_t handler) {
30700         LDKChannelMonitor this_arg_conv;
30701         this_arg_conv.inner = untag_ptr(this_arg);
30702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30704         this_arg_conv.is_owned = false;
30705         void* handler_ptr = untag_ptr(handler);
30706         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
30707         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
30708         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
30709 }
30710
30711 int8_tArray  __attribute__((export_name("TS_ChannelMonitor_get_counterparty_node_id"))) TS_ChannelMonitor_get_counterparty_node_id(uint64_t this_arg) {
30712         LDKChannelMonitor this_arg_conv;
30713         this_arg_conv.inner = untag_ptr(this_arg);
30714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30716         this_arg_conv.is_owned = false;
30717         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
30718         memcpy(ret_arr->elems, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form, 33);
30719         return ret_arr;
30720 }
30721
30722 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) {
30723         LDKChannelMonitor this_arg_conv;
30724         this_arg_conv.inner = untag_ptr(this_arg);
30725         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30727         this_arg_conv.is_owned = false;
30728         void* logger_ptr = untag_ptr(logger);
30729         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
30730         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
30731         LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
30732         ptrArray ret_arr = NULL;
30733         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
30734         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
30735         for (size_t m = 0; m < ret_var.datalen; m++) {
30736                 LDKTransaction ret_conv_12_var = ret_var.data[m];
30737                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
30738                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
30739                 Transaction_free(ret_conv_12_var);
30740                 ret_arr_ptr[m] = ret_conv_12_arr;
30741         }
30742         
30743         FREE(ret_var.data);
30744         return ret_arr;
30745 }
30746
30747 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) {
30748         LDKChannelMonitor this_arg_conv;
30749         this_arg_conv.inner = untag_ptr(this_arg);
30750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30752         this_arg_conv.is_owned = false;
30753         uint8_t header_arr[80];
30754         CHECK(header->arr_len == 80);
30755         memcpy(header_arr, header->elems, 80); FREE(header);
30756         uint8_t (*header_ref)[80] = &header_arr;
30757         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
30758         txdata_constr.datalen = txdata->arr_len;
30759         if (txdata_constr.datalen > 0)
30760                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
30761         else
30762                 txdata_constr.data = NULL;
30763         uint64_t* txdata_vals = txdata->elems;
30764         for (size_t c = 0; c < txdata_constr.datalen; c++) {
30765                 uint64_t txdata_conv_28 = txdata_vals[c];
30766                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
30767                 CHECK_ACCESS(txdata_conv_28_ptr);
30768                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
30769                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
30770                 txdata_constr.data[c] = txdata_conv_28_conv;
30771         }
30772         FREE(txdata);
30773         void* broadcaster_ptr = untag_ptr(broadcaster);
30774         CHECK_ACCESS(broadcaster_ptr);
30775         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30776         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30777                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30778                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30779         }
30780         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30781         CHECK_ACCESS(fee_estimator_ptr);
30782         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30783         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30784                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30785                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30786         }
30787         void* logger_ptr = untag_ptr(logger);
30788         CHECK_ACCESS(logger_ptr);
30789         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30790         if (logger_conv.free == LDKLogger_JCalls_free) {
30791                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30792                 LDKLogger_JCalls_cloned(&logger_conv);
30793         }
30794         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30795         uint64_tArray ret_arr = NULL;
30796         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30797         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30798         for (size_t n = 0; n < ret_var.datalen; n++) {
30799                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
30800                 *ret_conv_39_conv = ret_var.data[n];
30801                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
30802         }
30803         
30804         FREE(ret_var.data);
30805         return ret_arr;
30806 }
30807
30808 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) {
30809         LDKChannelMonitor this_arg_conv;
30810         this_arg_conv.inner = untag_ptr(this_arg);
30811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30813         this_arg_conv.is_owned = false;
30814         uint8_t header_arr[80];
30815         CHECK(header->arr_len == 80);
30816         memcpy(header_arr, header->elems, 80); FREE(header);
30817         uint8_t (*header_ref)[80] = &header_arr;
30818         void* broadcaster_ptr = untag_ptr(broadcaster);
30819         CHECK_ACCESS(broadcaster_ptr);
30820         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30821         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30822                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30823                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30824         }
30825         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30826         CHECK_ACCESS(fee_estimator_ptr);
30827         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30828         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30829                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30830                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30831         }
30832         void* logger_ptr = untag_ptr(logger);
30833         CHECK_ACCESS(logger_ptr);
30834         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30835         if (logger_conv.free == LDKLogger_JCalls_free) {
30836                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30837                 LDKLogger_JCalls_cloned(&logger_conv);
30838         }
30839         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30840 }
30841
30842 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) {
30843         LDKChannelMonitor this_arg_conv;
30844         this_arg_conv.inner = untag_ptr(this_arg);
30845         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30847         this_arg_conv.is_owned = false;
30848         uint8_t header_arr[80];
30849         CHECK(header->arr_len == 80);
30850         memcpy(header_arr, header->elems, 80); FREE(header);
30851         uint8_t (*header_ref)[80] = &header_arr;
30852         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
30853         txdata_constr.datalen = txdata->arr_len;
30854         if (txdata_constr.datalen > 0)
30855                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
30856         else
30857                 txdata_constr.data = NULL;
30858         uint64_t* txdata_vals = txdata->elems;
30859         for (size_t c = 0; c < txdata_constr.datalen; c++) {
30860                 uint64_t txdata_conv_28 = txdata_vals[c];
30861                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
30862                 CHECK_ACCESS(txdata_conv_28_ptr);
30863                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
30864                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
30865                 txdata_constr.data[c] = txdata_conv_28_conv;
30866         }
30867         FREE(txdata);
30868         void* broadcaster_ptr = untag_ptr(broadcaster);
30869         CHECK_ACCESS(broadcaster_ptr);
30870         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30871         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30872                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30873                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30874         }
30875         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30876         CHECK_ACCESS(fee_estimator_ptr);
30877         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30878         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30879                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30880                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30881         }
30882         void* logger_ptr = untag_ptr(logger);
30883         CHECK_ACCESS(logger_ptr);
30884         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30885         if (logger_conv.free == LDKLogger_JCalls_free) {
30886                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30887                 LDKLogger_JCalls_cloned(&logger_conv);
30888         }
30889         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30890         uint64_tArray ret_arr = NULL;
30891         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30892         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30893         for (size_t n = 0; n < ret_var.datalen; n++) {
30894                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
30895                 *ret_conv_39_conv = ret_var.data[n];
30896                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
30897         }
30898         
30899         FREE(ret_var.data);
30900         return ret_arr;
30901 }
30902
30903 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) {
30904         LDKChannelMonitor this_arg_conv;
30905         this_arg_conv.inner = untag_ptr(this_arg);
30906         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30908         this_arg_conv.is_owned = false;
30909         uint8_t txid_arr[32];
30910         CHECK(txid->arr_len == 32);
30911         memcpy(txid_arr, txid->elems, 32); FREE(txid);
30912         uint8_t (*txid_ref)[32] = &txid_arr;
30913         void* broadcaster_ptr = untag_ptr(broadcaster);
30914         CHECK_ACCESS(broadcaster_ptr);
30915         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30916         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30917                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30918                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30919         }
30920         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30921         CHECK_ACCESS(fee_estimator_ptr);
30922         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30923         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30924                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30925                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30926         }
30927         void* logger_ptr = untag_ptr(logger);
30928         CHECK_ACCESS(logger_ptr);
30929         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30930         if (logger_conv.free == LDKLogger_JCalls_free) {
30931                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30932                 LDKLogger_JCalls_cloned(&logger_conv);
30933         }
30934         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
30935 }
30936
30937 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) {
30938         LDKChannelMonitor this_arg_conv;
30939         this_arg_conv.inner = untag_ptr(this_arg);
30940         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30942         this_arg_conv.is_owned = false;
30943         uint8_t header_arr[80];
30944         CHECK(header->arr_len == 80);
30945         memcpy(header_arr, header->elems, 80); FREE(header);
30946         uint8_t (*header_ref)[80] = &header_arr;
30947         void* broadcaster_ptr = untag_ptr(broadcaster);
30948         CHECK_ACCESS(broadcaster_ptr);
30949         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
30950         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
30951                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30952                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
30953         }
30954         void* fee_estimator_ptr = untag_ptr(fee_estimator);
30955         CHECK_ACCESS(fee_estimator_ptr);
30956         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
30957         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
30958                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30959                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
30960         }
30961         void* logger_ptr = untag_ptr(logger);
30962         CHECK_ACCESS(logger_ptr);
30963         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
30964         if (logger_conv.free == LDKLogger_JCalls_free) {
30965                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
30966                 LDKLogger_JCalls_cloned(&logger_conv);
30967         }
30968         LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
30969         uint64_tArray ret_arr = NULL;
30970         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30971         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30972         for (size_t n = 0; n < ret_var.datalen; n++) {
30973                 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_39_conv = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
30974                 *ret_conv_39_conv = ret_var.data[n];
30975                 ret_arr_ptr[n] = tag_ptr(ret_conv_39_conv, true);
30976         }
30977         
30978         FREE(ret_var.data);
30979         return ret_arr;
30980 }
30981
30982 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) {
30983         LDKChannelMonitor this_arg_conv;
30984         this_arg_conv.inner = untag_ptr(this_arg);
30985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
30986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
30987         this_arg_conv.is_owned = false;
30988         LDKCVec_C2Tuple_TxidCOption_BlockHashZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
30989         uint64_tArray ret_arr = NULL;
30990         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
30991         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
30992         for (size_t i = 0; i < ret_var.datalen; i++) {
30993                 LDKC2Tuple_TxidCOption_BlockHashZZ* ret_conv_34_conv = MALLOC(sizeof(LDKC2Tuple_TxidCOption_BlockHashZZ), "LDKC2Tuple_TxidCOption_BlockHashZZ");
30994                 *ret_conv_34_conv = ret_var.data[i];
30995                 ret_arr_ptr[i] = tag_ptr(ret_conv_34_conv, true);
30996         }
30997         
30998         FREE(ret_var.data);
30999         return ret_arr;
31000 }
31001
31002 uint64_t  __attribute__((export_name("TS_ChannelMonitor_current_best_block"))) TS_ChannelMonitor_current_best_block(uint64_t this_arg) {
31003         LDKChannelMonitor this_arg_conv;
31004         this_arg_conv.inner = untag_ptr(this_arg);
31005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31007         this_arg_conv.is_owned = false;
31008         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
31009         uint64_t ret_ref = 0;
31010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31012         return ret_ref;
31013 }
31014
31015 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) {
31016         LDKChannelMonitor this_arg_conv;
31017         this_arg_conv.inner = untag_ptr(this_arg);
31018         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31020         this_arg_conv.is_owned = false;
31021         void* broadcaster_ptr = untag_ptr(broadcaster);
31022         CHECK_ACCESS(broadcaster_ptr);
31023         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
31024         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
31025                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31026                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
31027         }
31028         void* fee_estimator_ptr = untag_ptr(fee_estimator);
31029         CHECK_ACCESS(fee_estimator_ptr);
31030         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
31031         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
31032                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31033                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
31034         }
31035         void* logger_ptr = untag_ptr(logger);
31036         CHECK_ACCESS(logger_ptr);
31037         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
31038         if (logger_conv.free == LDKLogger_JCalls_free) {
31039                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
31040                 LDKLogger_JCalls_cloned(&logger_conv);
31041         }
31042         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
31043 }
31044
31045 uint64_tArray  __attribute__((export_name("TS_ChannelMonitor_get_claimable_balances"))) TS_ChannelMonitor_get_claimable_balances(uint64_t this_arg) {
31046         LDKChannelMonitor this_arg_conv;
31047         this_arg_conv.inner = untag_ptr(this_arg);
31048         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31050         this_arg_conv.is_owned = false;
31051         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
31052         uint64_tArray ret_arr = NULL;
31053         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
31054         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
31055         for (size_t j = 0; j < ret_var.datalen; j++) {
31056                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
31057                 *ret_conv_9_copy = ret_var.data[j];
31058                 uint64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
31059                 ret_arr_ptr[j] = ret_conv_9_ref;
31060         }
31061         
31062         FREE(ret_var.data);
31063         return ret_arr;
31064 }
31065
31066 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) {
31067         LDKu8slice ser_ref;
31068         ser_ref.datalen = ser->arr_len;
31069         ser_ref.data = ser->elems;
31070         void* arg_a_ptr = untag_ptr(arg_a);
31071         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
31072         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
31073         void* arg_b_ptr = untag_ptr(arg_b);
31074         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
31075         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
31076         LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
31077         *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
31078         FREE(ser);
31079         return tag_ptr(ret_conv, true);
31080 }
31081
31082 void  __attribute__((export_name("TS_OutPoint_free"))) TS_OutPoint_free(uint64_t this_obj) {
31083         LDKOutPoint this_obj_conv;
31084         this_obj_conv.inner = untag_ptr(this_obj);
31085         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31087         OutPoint_free(this_obj_conv);
31088 }
31089
31090 int8_tArray  __attribute__((export_name("TS_OutPoint_get_txid"))) TS_OutPoint_get_txid(uint64_t this_ptr) {
31091         LDKOutPoint this_ptr_conv;
31092         this_ptr_conv.inner = untag_ptr(this_ptr);
31093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31095         this_ptr_conv.is_owned = false;
31096         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31097         memcpy(ret_arr->elems, *OutPoint_get_txid(&this_ptr_conv), 32);
31098         return ret_arr;
31099 }
31100
31101 void  __attribute__((export_name("TS_OutPoint_set_txid"))) TS_OutPoint_set_txid(uint64_t this_ptr, int8_tArray val) {
31102         LDKOutPoint this_ptr_conv;
31103         this_ptr_conv.inner = untag_ptr(this_ptr);
31104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31106         this_ptr_conv.is_owned = false;
31107         LDKThirtyTwoBytes val_ref;
31108         CHECK(val->arr_len == 32);
31109         memcpy(val_ref.data, val->elems, 32); FREE(val);
31110         OutPoint_set_txid(&this_ptr_conv, val_ref);
31111 }
31112
31113 int16_t  __attribute__((export_name("TS_OutPoint_get_index"))) TS_OutPoint_get_index(uint64_t this_ptr) {
31114         LDKOutPoint this_ptr_conv;
31115         this_ptr_conv.inner = untag_ptr(this_ptr);
31116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31118         this_ptr_conv.is_owned = false;
31119         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
31120         return ret_conv;
31121 }
31122
31123 void  __attribute__((export_name("TS_OutPoint_set_index"))) TS_OutPoint_set_index(uint64_t this_ptr, int16_t val) {
31124         LDKOutPoint this_ptr_conv;
31125         this_ptr_conv.inner = untag_ptr(this_ptr);
31126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31128         this_ptr_conv.is_owned = false;
31129         OutPoint_set_index(&this_ptr_conv, val);
31130 }
31131
31132 uint64_t  __attribute__((export_name("TS_OutPoint_new"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) {
31133         LDKThirtyTwoBytes txid_arg_ref;
31134         CHECK(txid_arg->arr_len == 32);
31135         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
31136         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
31137         uint64_t ret_ref = 0;
31138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31140         return ret_ref;
31141 }
31142
31143 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
31144         LDKOutPoint ret_var = OutPoint_clone(arg);
31145         uint64_t ret_ref = 0;
31146         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31147         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31148         return ret_ref;
31149 }
31150 int64_t  __attribute__((export_name("TS_OutPoint_clone_ptr"))) TS_OutPoint_clone_ptr(uint64_t arg) {
31151         LDKOutPoint arg_conv;
31152         arg_conv.inner = untag_ptr(arg);
31153         arg_conv.is_owned = ptr_is_owned(arg);
31154         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31155         arg_conv.is_owned = false;
31156         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
31157         return ret_conv;
31158 }
31159
31160 uint64_t  __attribute__((export_name("TS_OutPoint_clone"))) TS_OutPoint_clone(uint64_t orig) {
31161         LDKOutPoint orig_conv;
31162         orig_conv.inner = untag_ptr(orig);
31163         orig_conv.is_owned = ptr_is_owned(orig);
31164         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31165         orig_conv.is_owned = false;
31166         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
31167         uint64_t ret_ref = 0;
31168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31170         return ret_ref;
31171 }
31172
31173 jboolean  __attribute__((export_name("TS_OutPoint_eq"))) TS_OutPoint_eq(uint64_t a, uint64_t b) {
31174         LDKOutPoint a_conv;
31175         a_conv.inner = untag_ptr(a);
31176         a_conv.is_owned = ptr_is_owned(a);
31177         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31178         a_conv.is_owned = false;
31179         LDKOutPoint b_conv;
31180         b_conv.inner = untag_ptr(b);
31181         b_conv.is_owned = ptr_is_owned(b);
31182         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31183         b_conv.is_owned = false;
31184         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
31185         return ret_conv;
31186 }
31187
31188 int64_t  __attribute__((export_name("TS_OutPoint_hash"))) TS_OutPoint_hash(uint64_t o) {
31189         LDKOutPoint o_conv;
31190         o_conv.inner = untag_ptr(o);
31191         o_conv.is_owned = ptr_is_owned(o);
31192         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31193         o_conv.is_owned = false;
31194         int64_t ret_conv = OutPoint_hash(&o_conv);
31195         return ret_conv;
31196 }
31197
31198 int8_tArray  __attribute__((export_name("TS_OutPoint_to_channel_id"))) TS_OutPoint_to_channel_id(uint64_t this_arg) {
31199         LDKOutPoint this_arg_conv;
31200         this_arg_conv.inner = untag_ptr(this_arg);
31201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
31202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
31203         this_arg_conv.is_owned = false;
31204         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31205         memcpy(ret_arr->elems, OutPoint_to_channel_id(&this_arg_conv).data, 32);
31206         return ret_arr;
31207 }
31208
31209 int8_tArray  __attribute__((export_name("TS_OutPoint_write"))) TS_OutPoint_write(uint64_t obj) {
31210         LDKOutPoint obj_conv;
31211         obj_conv.inner = untag_ptr(obj);
31212         obj_conv.is_owned = ptr_is_owned(obj);
31213         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
31214         obj_conv.is_owned = false;
31215         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
31216         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
31217         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
31218         CVec_u8Z_free(ret_var);
31219         return ret_arr;
31220 }
31221
31222 uint64_t  __attribute__((export_name("TS_OutPoint_read"))) TS_OutPoint_read(int8_tArray ser) {
31223         LDKu8slice ser_ref;
31224         ser_ref.datalen = ser->arr_len;
31225         ser_ref.data = ser->elems;
31226         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
31227         *ret_conv = OutPoint_read(ser_ref);
31228         FREE(ser);
31229         return tag_ptr(ret_conv, true);
31230 }
31231
31232 uint32_t  __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) {
31233         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
31234         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_clone(orig_conv));
31235         return ret_conv;
31236 }
31237
31238 uint32_t  __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() {
31239         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_temporary_node_failure());
31240         return ret_conv;
31241 }
31242
31243 uint32_t  __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() {
31244         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_required_node_feature_missing());
31245         return ret_conv;
31246 }
31247
31248 uint32_t  __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() {
31249         uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_incorrect_or_unknown_payment_details());
31250         return ret_conv;
31251 }
31252
31253 void  __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) {
31254         LDKChannelManager this_obj_conv;
31255         this_obj_conv.inner = untag_ptr(this_obj);
31256         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31258         ChannelManager_free(this_obj_conv);
31259 }
31260
31261 void  __attribute__((export_name("TS_ChainParameters_free"))) TS_ChainParameters_free(uint64_t this_obj) {
31262         LDKChainParameters this_obj_conv;
31263         this_obj_conv.inner = untag_ptr(this_obj);
31264         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31266         ChainParameters_free(this_obj_conv);
31267 }
31268
31269 uint32_t  __attribute__((export_name("TS_ChainParameters_get_network"))) TS_ChainParameters_get_network(uint64_t this_ptr) {
31270         LDKChainParameters this_ptr_conv;
31271         this_ptr_conv.inner = untag_ptr(this_ptr);
31272         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31274         this_ptr_conv.is_owned = false;
31275         uint32_t ret_conv = LDKNetwork_to_js(ChainParameters_get_network(&this_ptr_conv));
31276         return ret_conv;
31277 }
31278
31279 void  __attribute__((export_name("TS_ChainParameters_set_network"))) TS_ChainParameters_set_network(uint64_t this_ptr, uint32_t val) {
31280         LDKChainParameters this_ptr_conv;
31281         this_ptr_conv.inner = untag_ptr(this_ptr);
31282         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31283         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31284         this_ptr_conv.is_owned = false;
31285         LDKNetwork val_conv = LDKNetwork_from_js(val);
31286         ChainParameters_set_network(&this_ptr_conv, val_conv);
31287 }
31288
31289 uint64_t  __attribute__((export_name("TS_ChainParameters_get_best_block"))) TS_ChainParameters_get_best_block(uint64_t this_ptr) {
31290         LDKChainParameters this_ptr_conv;
31291         this_ptr_conv.inner = untag_ptr(this_ptr);
31292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31294         this_ptr_conv.is_owned = false;
31295         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
31296         uint64_t ret_ref = 0;
31297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31299         return ret_ref;
31300 }
31301
31302 void  __attribute__((export_name("TS_ChainParameters_set_best_block"))) TS_ChainParameters_set_best_block(uint64_t this_ptr, uint64_t val) {
31303         LDKChainParameters this_ptr_conv;
31304         this_ptr_conv.inner = untag_ptr(this_ptr);
31305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31307         this_ptr_conv.is_owned = false;
31308         LDKBestBlock val_conv;
31309         val_conv.inner = untag_ptr(val);
31310         val_conv.is_owned = ptr_is_owned(val);
31311         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31312         val_conv = BestBlock_clone(&val_conv);
31313         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
31314 }
31315
31316 uint64_t  __attribute__((export_name("TS_ChainParameters_new"))) TS_ChainParameters_new(uint32_t network_arg, uint64_t best_block_arg) {
31317         LDKNetwork network_arg_conv = LDKNetwork_from_js(network_arg);
31318         LDKBestBlock best_block_arg_conv;
31319         best_block_arg_conv.inner = untag_ptr(best_block_arg);
31320         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
31321         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
31322         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
31323         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
31324         uint64_t ret_ref = 0;
31325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31327         return ret_ref;
31328 }
31329
31330 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
31331         LDKChainParameters ret_var = ChainParameters_clone(arg);
31332         uint64_t ret_ref = 0;
31333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31335         return ret_ref;
31336 }
31337 int64_t  __attribute__((export_name("TS_ChainParameters_clone_ptr"))) TS_ChainParameters_clone_ptr(uint64_t arg) {
31338         LDKChainParameters arg_conv;
31339         arg_conv.inner = untag_ptr(arg);
31340         arg_conv.is_owned = ptr_is_owned(arg);
31341         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31342         arg_conv.is_owned = false;
31343         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
31344         return ret_conv;
31345 }
31346
31347 uint64_t  __attribute__((export_name("TS_ChainParameters_clone"))) TS_ChainParameters_clone(uint64_t orig) {
31348         LDKChainParameters orig_conv;
31349         orig_conv.inner = untag_ptr(orig);
31350         orig_conv.is_owned = ptr_is_owned(orig);
31351         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31352         orig_conv.is_owned = false;
31353         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
31354         uint64_t ret_ref = 0;
31355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31357         return ret_ref;
31358 }
31359
31360 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_free"))) TS_CounterpartyForwardingInfo_free(uint64_t this_obj) {
31361         LDKCounterpartyForwardingInfo this_obj_conv;
31362         this_obj_conv.inner = untag_ptr(this_obj);
31363         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31365         CounterpartyForwardingInfo_free(this_obj_conv);
31366 }
31367
31368 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_base_msat"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint64_t this_ptr) {
31369         LDKCounterpartyForwardingInfo this_ptr_conv;
31370         this_ptr_conv.inner = untag_ptr(this_ptr);
31371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31373         this_ptr_conv.is_owned = false;
31374         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
31375         return ret_conv;
31376 }
31377
31378 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_base_msat"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
31379         LDKCounterpartyForwardingInfo this_ptr_conv;
31380         this_ptr_conv.inner = untag_ptr(this_ptr);
31381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31383         this_ptr_conv.is_owned = false;
31384         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
31385 }
31386
31387 int32_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
31388         LDKCounterpartyForwardingInfo this_ptr_conv;
31389         this_ptr_conv.inner = untag_ptr(this_ptr);
31390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31392         this_ptr_conv.is_owned = false;
31393         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
31394         return ret_conv;
31395 }
31396
31397 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_fee_proportional_millionths"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
31398         LDKCounterpartyForwardingInfo this_ptr_conv;
31399         this_ptr_conv.inner = untag_ptr(this_ptr);
31400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31402         this_ptr_conv.is_owned = false;
31403         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
31404 }
31405
31406 int16_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_get_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
31407         LDKCounterpartyForwardingInfo this_ptr_conv;
31408         this_ptr_conv.inner = untag_ptr(this_ptr);
31409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31411         this_ptr_conv.is_owned = false;
31412         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
31413         return ret_conv;
31414 }
31415
31416 void  __attribute__((export_name("TS_CounterpartyForwardingInfo_set_cltv_expiry_delta"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
31417         LDKCounterpartyForwardingInfo this_ptr_conv;
31418         this_ptr_conv.inner = untag_ptr(this_ptr);
31419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31421         this_ptr_conv.is_owned = false;
31422         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
31423 }
31424
31425 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) {
31426         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
31427         uint64_t ret_ref = 0;
31428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31430         return ret_ref;
31431 }
31432
31433 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
31434         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
31435         uint64_t ret_ref = 0;
31436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31438         return ret_ref;
31439 }
31440 int64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone_ptr"))) TS_CounterpartyForwardingInfo_clone_ptr(uint64_t arg) {
31441         LDKCounterpartyForwardingInfo arg_conv;
31442         arg_conv.inner = untag_ptr(arg);
31443         arg_conv.is_owned = ptr_is_owned(arg);
31444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31445         arg_conv.is_owned = false;
31446         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
31447         return ret_conv;
31448 }
31449
31450 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_clone"))) TS_CounterpartyForwardingInfo_clone(uint64_t orig) {
31451         LDKCounterpartyForwardingInfo orig_conv;
31452         orig_conv.inner = untag_ptr(orig);
31453         orig_conv.is_owned = ptr_is_owned(orig);
31454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31455         orig_conv.is_owned = false;
31456         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
31457         uint64_t ret_ref = 0;
31458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31460         return ret_ref;
31461 }
31462
31463 void  __attribute__((export_name("TS_ChannelCounterparty_free"))) TS_ChannelCounterparty_free(uint64_t this_obj) {
31464         LDKChannelCounterparty this_obj_conv;
31465         this_obj_conv.inner = untag_ptr(this_obj);
31466         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31468         ChannelCounterparty_free(this_obj_conv);
31469 }
31470
31471 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_get_node_id"))) TS_ChannelCounterparty_get_node_id(uint64_t this_ptr) {
31472         LDKChannelCounterparty this_ptr_conv;
31473         this_ptr_conv.inner = untag_ptr(this_ptr);
31474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31476         this_ptr_conv.is_owned = false;
31477         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
31478         memcpy(ret_arr->elems, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
31479         return ret_arr;
31480 }
31481
31482 void  __attribute__((export_name("TS_ChannelCounterparty_set_node_id"))) TS_ChannelCounterparty_set_node_id(uint64_t this_ptr, int8_tArray val) {
31483         LDKChannelCounterparty this_ptr_conv;
31484         this_ptr_conv.inner = untag_ptr(this_ptr);
31485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31487         this_ptr_conv.is_owned = false;
31488         LDKPublicKey val_ref;
31489         CHECK(val->arr_len == 33);
31490         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
31491         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
31492 }
31493
31494 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_features"))) TS_ChannelCounterparty_get_features(uint64_t this_ptr) {
31495         LDKChannelCounterparty this_ptr_conv;
31496         this_ptr_conv.inner = untag_ptr(this_ptr);
31497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31499         this_ptr_conv.is_owned = false;
31500         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
31501         uint64_t ret_ref = 0;
31502         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31503         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31504         return ret_ref;
31505 }
31506
31507 void  __attribute__((export_name("TS_ChannelCounterparty_set_features"))) TS_ChannelCounterparty_set_features(uint64_t this_ptr, uint64_t val) {
31508         LDKChannelCounterparty this_ptr_conv;
31509         this_ptr_conv.inner = untag_ptr(this_ptr);
31510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31512         this_ptr_conv.is_owned = false;
31513         LDKInitFeatures val_conv;
31514         val_conv.inner = untag_ptr(val);
31515         val_conv.is_owned = ptr_is_owned(val);
31516         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31517         val_conv = InitFeatures_clone(&val_conv);
31518         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
31519 }
31520
31521 int64_t  __attribute__((export_name("TS_ChannelCounterparty_get_unspendable_punishment_reserve"))) TS_ChannelCounterparty_get_unspendable_punishment_reserve(uint64_t this_ptr) {
31522         LDKChannelCounterparty this_ptr_conv;
31523         this_ptr_conv.inner = untag_ptr(this_ptr);
31524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31526         this_ptr_conv.is_owned = false;
31527         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
31528         return ret_conv;
31529 }
31530
31531 void  __attribute__((export_name("TS_ChannelCounterparty_set_unspendable_punishment_reserve"))) TS_ChannelCounterparty_set_unspendable_punishment_reserve(uint64_t this_ptr, int64_t val) {
31532         LDKChannelCounterparty this_ptr_conv;
31533         this_ptr_conv.inner = untag_ptr(this_ptr);
31534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31536         this_ptr_conv.is_owned = false;
31537         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
31538 }
31539
31540 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_forwarding_info"))) TS_ChannelCounterparty_get_forwarding_info(uint64_t this_ptr) {
31541         LDKChannelCounterparty this_ptr_conv;
31542         this_ptr_conv.inner = untag_ptr(this_ptr);
31543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31545         this_ptr_conv.is_owned = false;
31546         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
31547         uint64_t ret_ref = 0;
31548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31550         return ret_ref;
31551 }
31552
31553 void  __attribute__((export_name("TS_ChannelCounterparty_set_forwarding_info"))) TS_ChannelCounterparty_set_forwarding_info(uint64_t this_ptr, uint64_t val) {
31554         LDKChannelCounterparty this_ptr_conv;
31555         this_ptr_conv.inner = untag_ptr(this_ptr);
31556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31558         this_ptr_conv.is_owned = false;
31559         LDKCounterpartyForwardingInfo val_conv;
31560         val_conv.inner = untag_ptr(val);
31561         val_conv.is_owned = ptr_is_owned(val);
31562         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31563         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
31564         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
31565 }
31566
31567 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_minimum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_minimum_msat(uint64_t this_ptr) {
31568         LDKChannelCounterparty this_ptr_conv;
31569         this_ptr_conv.inner = untag_ptr(this_ptr);
31570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31572         this_ptr_conv.is_owned = false;
31573         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31574         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
31575         uint64_t ret_ref = tag_ptr(ret_copy, true);
31576         return ret_ref;
31577 }
31578
31579 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) {
31580         LDKChannelCounterparty this_ptr_conv;
31581         this_ptr_conv.inner = untag_ptr(this_ptr);
31582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31584         this_ptr_conv.is_owned = false;
31585         void* val_ptr = untag_ptr(val);
31586         CHECK_ACCESS(val_ptr);
31587         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31588         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31589         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
31590 }
31591
31592 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_get_outbound_htlc_maximum_msat"))) TS_ChannelCounterparty_get_outbound_htlc_maximum_msat(uint64_t this_ptr) {
31593         LDKChannelCounterparty this_ptr_conv;
31594         this_ptr_conv.inner = untag_ptr(this_ptr);
31595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31597         this_ptr_conv.is_owned = false;
31598         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31599         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
31600         uint64_t ret_ref = tag_ptr(ret_copy, true);
31601         return ret_ref;
31602 }
31603
31604 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) {
31605         LDKChannelCounterparty this_ptr_conv;
31606         this_ptr_conv.inner = untag_ptr(this_ptr);
31607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31609         this_ptr_conv.is_owned = false;
31610         void* val_ptr = untag_ptr(val);
31611         CHECK_ACCESS(val_ptr);
31612         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31613         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31614         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
31615 }
31616
31617 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) {
31618         LDKPublicKey node_id_arg_ref;
31619         CHECK(node_id_arg->arr_len == 33);
31620         memcpy(node_id_arg_ref.compressed_form, node_id_arg->elems, 33); FREE(node_id_arg);
31621         LDKInitFeatures features_arg_conv;
31622         features_arg_conv.inner = untag_ptr(features_arg);
31623         features_arg_conv.is_owned = ptr_is_owned(features_arg);
31624         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
31625         features_arg_conv = InitFeatures_clone(&features_arg_conv);
31626         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
31627         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
31628         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
31629         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
31630         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
31631         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
31632         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
31633         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
31634         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
31635         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
31636         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
31637         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
31638         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
31639         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);
31640         uint64_t ret_ref = 0;
31641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31643         return ret_ref;
31644 }
31645
31646 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
31647         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
31648         uint64_t ret_ref = 0;
31649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31651         return ret_ref;
31652 }
31653 int64_t  __attribute__((export_name("TS_ChannelCounterparty_clone_ptr"))) TS_ChannelCounterparty_clone_ptr(uint64_t arg) {
31654         LDKChannelCounterparty arg_conv;
31655         arg_conv.inner = untag_ptr(arg);
31656         arg_conv.is_owned = ptr_is_owned(arg);
31657         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
31658         arg_conv.is_owned = false;
31659         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
31660         return ret_conv;
31661 }
31662
31663 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_clone"))) TS_ChannelCounterparty_clone(uint64_t orig) {
31664         LDKChannelCounterparty orig_conv;
31665         orig_conv.inner = untag_ptr(orig);
31666         orig_conv.is_owned = ptr_is_owned(orig);
31667         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
31668         orig_conv.is_owned = false;
31669         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
31670         uint64_t ret_ref = 0;
31671         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31672         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31673         return ret_ref;
31674 }
31675
31676 void  __attribute__((export_name("TS_ChannelDetails_free"))) TS_ChannelDetails_free(uint64_t this_obj) {
31677         LDKChannelDetails this_obj_conv;
31678         this_obj_conv.inner = untag_ptr(this_obj);
31679         this_obj_conv.is_owned = ptr_is_owned(this_obj);
31680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
31681         ChannelDetails_free(this_obj_conv);
31682 }
31683
31684 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_channel_id"))) TS_ChannelDetails_get_channel_id(uint64_t this_ptr) {
31685         LDKChannelDetails this_ptr_conv;
31686         this_ptr_conv.inner = untag_ptr(this_ptr);
31687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31689         this_ptr_conv.is_owned = false;
31690         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
31691         memcpy(ret_arr->elems, *ChannelDetails_get_channel_id(&this_ptr_conv), 32);
31692         return ret_arr;
31693 }
31694
31695 void  __attribute__((export_name("TS_ChannelDetails_set_channel_id"))) TS_ChannelDetails_set_channel_id(uint64_t this_ptr, int8_tArray val) {
31696         LDKChannelDetails this_ptr_conv;
31697         this_ptr_conv.inner = untag_ptr(this_ptr);
31698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31700         this_ptr_conv.is_owned = false;
31701         LDKThirtyTwoBytes val_ref;
31702         CHECK(val->arr_len == 32);
31703         memcpy(val_ref.data, val->elems, 32); FREE(val);
31704         ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
31705 }
31706
31707 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_counterparty"))) TS_ChannelDetails_get_counterparty(uint64_t this_ptr) {
31708         LDKChannelDetails this_ptr_conv;
31709         this_ptr_conv.inner = untag_ptr(this_ptr);
31710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31712         this_ptr_conv.is_owned = false;
31713         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
31714         uint64_t ret_ref = 0;
31715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31717         return ret_ref;
31718 }
31719
31720 void  __attribute__((export_name("TS_ChannelDetails_set_counterparty"))) TS_ChannelDetails_set_counterparty(uint64_t this_ptr, uint64_t val) {
31721         LDKChannelDetails this_ptr_conv;
31722         this_ptr_conv.inner = untag_ptr(this_ptr);
31723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31725         this_ptr_conv.is_owned = false;
31726         LDKChannelCounterparty val_conv;
31727         val_conv.inner = untag_ptr(val);
31728         val_conv.is_owned = ptr_is_owned(val);
31729         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31730         val_conv = ChannelCounterparty_clone(&val_conv);
31731         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
31732 }
31733
31734 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_funding_txo"))) TS_ChannelDetails_get_funding_txo(uint64_t this_ptr) {
31735         LDKChannelDetails this_ptr_conv;
31736         this_ptr_conv.inner = untag_ptr(this_ptr);
31737         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31739         this_ptr_conv.is_owned = false;
31740         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
31741         uint64_t ret_ref = 0;
31742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31744         return ret_ref;
31745 }
31746
31747 void  __attribute__((export_name("TS_ChannelDetails_set_funding_txo"))) TS_ChannelDetails_set_funding_txo(uint64_t this_ptr, uint64_t val) {
31748         LDKChannelDetails this_ptr_conv;
31749         this_ptr_conv.inner = untag_ptr(this_ptr);
31750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31752         this_ptr_conv.is_owned = false;
31753         LDKOutPoint val_conv;
31754         val_conv.inner = untag_ptr(val);
31755         val_conv.is_owned = ptr_is_owned(val);
31756         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31757         val_conv = OutPoint_clone(&val_conv);
31758         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
31759 }
31760
31761 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_type"))) TS_ChannelDetails_get_channel_type(uint64_t this_ptr) {
31762         LDKChannelDetails this_ptr_conv;
31763         this_ptr_conv.inner = untag_ptr(this_ptr);
31764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31766         this_ptr_conv.is_owned = false;
31767         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
31768         uint64_t ret_ref = 0;
31769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
31770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
31771         return ret_ref;
31772 }
31773
31774 void  __attribute__((export_name("TS_ChannelDetails_set_channel_type"))) TS_ChannelDetails_set_channel_type(uint64_t this_ptr, uint64_t val) {
31775         LDKChannelDetails this_ptr_conv;
31776         this_ptr_conv.inner = untag_ptr(this_ptr);
31777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31779         this_ptr_conv.is_owned = false;
31780         LDKChannelTypeFeatures val_conv;
31781         val_conv.inner = untag_ptr(val);
31782         val_conv.is_owned = ptr_is_owned(val);
31783         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
31784         val_conv = ChannelTypeFeatures_clone(&val_conv);
31785         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
31786 }
31787
31788 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_short_channel_id"))) TS_ChannelDetails_get_short_channel_id(uint64_t this_ptr) {
31789         LDKChannelDetails this_ptr_conv;
31790         this_ptr_conv.inner = untag_ptr(this_ptr);
31791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31793         this_ptr_conv.is_owned = false;
31794         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31795         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
31796         uint64_t ret_ref = tag_ptr(ret_copy, true);
31797         return ret_ref;
31798 }
31799
31800 void  __attribute__((export_name("TS_ChannelDetails_set_short_channel_id"))) TS_ChannelDetails_set_short_channel_id(uint64_t this_ptr, uint64_t val) {
31801         LDKChannelDetails this_ptr_conv;
31802         this_ptr_conv.inner = untag_ptr(this_ptr);
31803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31805         this_ptr_conv.is_owned = false;
31806         void* val_ptr = untag_ptr(val);
31807         CHECK_ACCESS(val_ptr);
31808         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31809         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31810         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
31811 }
31812
31813 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_scid_alias"))) TS_ChannelDetails_get_outbound_scid_alias(uint64_t this_ptr) {
31814         LDKChannelDetails this_ptr_conv;
31815         this_ptr_conv.inner = untag_ptr(this_ptr);
31816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31818         this_ptr_conv.is_owned = false;
31819         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31820         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
31821         uint64_t ret_ref = tag_ptr(ret_copy, true);
31822         return ret_ref;
31823 }
31824
31825 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_scid_alias"))) TS_ChannelDetails_set_outbound_scid_alias(uint64_t this_ptr, uint64_t val) {
31826         LDKChannelDetails this_ptr_conv;
31827         this_ptr_conv.inner = untag_ptr(this_ptr);
31828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31830         this_ptr_conv.is_owned = false;
31831         void* val_ptr = untag_ptr(val);
31832         CHECK_ACCESS(val_ptr);
31833         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31834         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31835         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
31836 }
31837
31838 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_scid_alias"))) TS_ChannelDetails_get_inbound_scid_alias(uint64_t this_ptr) {
31839         LDKChannelDetails this_ptr_conv;
31840         this_ptr_conv.inner = untag_ptr(this_ptr);
31841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31843         this_ptr_conv.is_owned = false;
31844         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31845         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
31846         uint64_t ret_ref = tag_ptr(ret_copy, true);
31847         return ret_ref;
31848 }
31849
31850 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_scid_alias"))) TS_ChannelDetails_set_inbound_scid_alias(uint64_t this_ptr, uint64_t val) {
31851         LDKChannelDetails this_ptr_conv;
31852         this_ptr_conv.inner = untag_ptr(this_ptr);
31853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31855         this_ptr_conv.is_owned = false;
31856         void* val_ptr = untag_ptr(val);
31857         CHECK_ACCESS(val_ptr);
31858         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31859         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31860         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
31861 }
31862
31863 int64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_value_satoshis"))) TS_ChannelDetails_get_channel_value_satoshis(uint64_t this_ptr) {
31864         LDKChannelDetails this_ptr_conv;
31865         this_ptr_conv.inner = untag_ptr(this_ptr);
31866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31868         this_ptr_conv.is_owned = false;
31869         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
31870         return ret_conv;
31871 }
31872
31873 void  __attribute__((export_name("TS_ChannelDetails_set_channel_value_satoshis"))) TS_ChannelDetails_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
31874         LDKChannelDetails this_ptr_conv;
31875         this_ptr_conv.inner = untag_ptr(this_ptr);
31876         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31878         this_ptr_conv.is_owned = false;
31879         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
31880 }
31881
31882 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_unspendable_punishment_reserve"))) TS_ChannelDetails_get_unspendable_punishment_reserve(uint64_t this_ptr) {
31883         LDKChannelDetails this_ptr_conv;
31884         this_ptr_conv.inner = untag_ptr(this_ptr);
31885         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31887         this_ptr_conv.is_owned = false;
31888         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
31889         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
31890         uint64_t ret_ref = tag_ptr(ret_copy, true);
31891         return ret_ref;
31892 }
31893
31894 void  __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_reserve"))) TS_ChannelDetails_set_unspendable_punishment_reserve(uint64_t this_ptr, uint64_t val) {
31895         LDKChannelDetails this_ptr_conv;
31896         this_ptr_conv.inner = untag_ptr(this_ptr);
31897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31899         this_ptr_conv.is_owned = false;
31900         void* val_ptr = untag_ptr(val);
31901         CHECK_ACCESS(val_ptr);
31902         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
31903         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
31904         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
31905 }
31906
31907 int8_tArray  __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) {
31908         LDKChannelDetails this_ptr_conv;
31909         this_ptr_conv.inner = untag_ptr(this_ptr);
31910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31912         this_ptr_conv.is_owned = false;
31913         int8_tArray ret_arr = init_int8_tArray(16, __LINE__);
31914         memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16);
31915         return ret_arr;
31916 }
31917
31918 void  __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) {
31919         LDKChannelDetails this_ptr_conv;
31920         this_ptr_conv.inner = untag_ptr(this_ptr);
31921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31923         this_ptr_conv.is_owned = false;
31924         LDKU128 val_ref;
31925         CHECK(val->arr_len == 16);
31926         memcpy(val_ref.le_bytes, val->elems, 16); FREE(val);
31927         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
31928 }
31929
31930 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) {
31931         LDKChannelDetails this_ptr_conv;
31932         this_ptr_conv.inner = untag_ptr(this_ptr);
31933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31935         this_ptr_conv.is_owned = false;
31936         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
31937         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
31938         uint64_t ret_ref = tag_ptr(ret_copy, true);
31939         return ret_ref;
31940 }
31941
31942 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) {
31943         LDKChannelDetails this_ptr_conv;
31944         this_ptr_conv.inner = untag_ptr(this_ptr);
31945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31947         this_ptr_conv.is_owned = false;
31948         void* val_ptr = untag_ptr(val);
31949         CHECK_ACCESS(val_ptr);
31950         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
31951         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
31952         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
31953 }
31954
31955 int64_t  __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) {
31956         LDKChannelDetails this_ptr_conv;
31957         this_ptr_conv.inner = untag_ptr(this_ptr);
31958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31960         this_ptr_conv.is_owned = false;
31961         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
31962         return ret_conv;
31963 }
31964
31965 void  __attribute__((export_name("TS_ChannelDetails_set_balance_msat"))) TS_ChannelDetails_set_balance_msat(uint64_t this_ptr, int64_t val) {
31966         LDKChannelDetails this_ptr_conv;
31967         this_ptr_conv.inner = untag_ptr(this_ptr);
31968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31970         this_ptr_conv.is_owned = false;
31971         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
31972 }
31973
31974 int64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_capacity_msat"))) TS_ChannelDetails_get_outbound_capacity_msat(uint64_t this_ptr) {
31975         LDKChannelDetails this_ptr_conv;
31976         this_ptr_conv.inner = untag_ptr(this_ptr);
31977         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31979         this_ptr_conv.is_owned = false;
31980         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
31981         return ret_conv;
31982 }
31983
31984 void  __attribute__((export_name("TS_ChannelDetails_set_outbound_capacity_msat"))) TS_ChannelDetails_set_outbound_capacity_msat(uint64_t this_ptr, int64_t val) {
31985         LDKChannelDetails this_ptr_conv;
31986         this_ptr_conv.inner = untag_ptr(this_ptr);
31987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31989         this_ptr_conv.is_owned = false;
31990         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
31991 }
31992
31993 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) {
31994         LDKChannelDetails this_ptr_conv;
31995         this_ptr_conv.inner = untag_ptr(this_ptr);
31996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
31997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
31998         this_ptr_conv.is_owned = false;
31999         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
32000         return ret_conv;
32001 }
32002
32003 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) {
32004         LDKChannelDetails this_ptr_conv;
32005         this_ptr_conv.inner = untag_ptr(this_ptr);
32006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32008         this_ptr_conv.is_owned = false;
32009         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
32010 }
32011
32012 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) {
32013         LDKChannelDetails this_ptr_conv;
32014         this_ptr_conv.inner = untag_ptr(this_ptr);
32015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32017         this_ptr_conv.is_owned = false;
32018         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
32019         return ret_conv;
32020 }
32021
32022 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) {
32023         LDKChannelDetails this_ptr_conv;
32024         this_ptr_conv.inner = untag_ptr(this_ptr);
32025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32027         this_ptr_conv.is_owned = false;
32028         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
32029 }
32030
32031 int64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_capacity_msat"))) TS_ChannelDetails_get_inbound_capacity_msat(uint64_t this_ptr) {
32032         LDKChannelDetails this_ptr_conv;
32033         this_ptr_conv.inner = untag_ptr(this_ptr);
32034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32036         this_ptr_conv.is_owned = false;
32037         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
32038         return ret_conv;
32039 }
32040
32041 void  __attribute__((export_name("TS_ChannelDetails_set_inbound_capacity_msat"))) TS_ChannelDetails_set_inbound_capacity_msat(uint64_t this_ptr, int64_t val) {
32042         LDKChannelDetails this_ptr_conv;
32043         this_ptr_conv.inner = untag_ptr(this_ptr);
32044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32046         this_ptr_conv.is_owned = false;
32047         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
32048 }
32049
32050 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations_required"))) TS_ChannelDetails_get_confirmations_required(uint64_t this_ptr) {
32051         LDKChannelDetails this_ptr_conv;
32052         this_ptr_conv.inner = untag_ptr(this_ptr);
32053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32055         this_ptr_conv.is_owned = false;
32056         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
32057         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
32058         uint64_t ret_ref = tag_ptr(ret_copy, true);
32059         return ret_ref;
32060 }
32061
32062 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations_required"))) TS_ChannelDetails_set_confirmations_required(uint64_t this_ptr, uint64_t val) {
32063         LDKChannelDetails this_ptr_conv;
32064         this_ptr_conv.inner = untag_ptr(this_ptr);
32065         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32067         this_ptr_conv.is_owned = false;
32068         void* val_ptr = untag_ptr(val);
32069         CHECK_ACCESS(val_ptr);
32070         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
32071         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
32072         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
32073 }
32074
32075 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) {
32076         LDKChannelDetails this_ptr_conv;
32077         this_ptr_conv.inner = untag_ptr(this_ptr);
32078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32080         this_ptr_conv.is_owned = false;
32081         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
32082         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
32083         uint64_t ret_ref = tag_ptr(ret_copy, true);
32084         return ret_ref;
32085 }
32086
32087 void  __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) {
32088         LDKChannelDetails this_ptr_conv;
32089         this_ptr_conv.inner = untag_ptr(this_ptr);
32090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32092         this_ptr_conv.is_owned = false;
32093         void* val_ptr = untag_ptr(val);
32094         CHECK_ACCESS(val_ptr);
32095         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
32096         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
32097         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
32098 }
32099
32100 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) {
32101         LDKChannelDetails this_ptr_conv;
32102         this_ptr_conv.inner = untag_ptr(this_ptr);
32103         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32105         this_ptr_conv.is_owned = false;
32106         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
32107         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
32108         uint64_t ret_ref = tag_ptr(ret_copy, true);
32109         return ret_ref;
32110 }
32111
32112 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) {
32113         LDKChannelDetails this_ptr_conv;
32114         this_ptr_conv.inner = untag_ptr(this_ptr);
32115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32117         this_ptr_conv.is_owned = false;
32118         void* val_ptr = untag_ptr(val);
32119         CHECK_ACCESS(val_ptr);
32120         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
32121         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
32122         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
32123 }
32124
32125 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_outbound"))) TS_ChannelDetails_get_is_outbound(uint64_t this_ptr) {
32126         LDKChannelDetails this_ptr_conv;
32127         this_ptr_conv.inner = untag_ptr(this_ptr);
32128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32130         this_ptr_conv.is_owned = false;
32131         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
32132         return ret_conv;
32133 }
32134
32135 void  __attribute__((export_name("TS_ChannelDetails_set_is_outbound"))) TS_ChannelDetails_set_is_outbound(uint64_t this_ptr, jboolean val) {
32136         LDKChannelDetails this_ptr_conv;
32137         this_ptr_conv.inner = untag_ptr(this_ptr);
32138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32140         this_ptr_conv.is_owned = false;
32141         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
32142 }
32143
32144 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_channel_ready"))) TS_ChannelDetails_get_is_channel_ready(uint64_t this_ptr) {
32145         LDKChannelDetails this_ptr_conv;
32146         this_ptr_conv.inner = untag_ptr(this_ptr);
32147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32149         this_ptr_conv.is_owned = false;
32150         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
32151         return ret_conv;
32152 }
32153
32154 void  __attribute__((export_name("TS_ChannelDetails_set_is_channel_ready"))) TS_ChannelDetails_set_is_channel_ready(uint64_t this_ptr, jboolean val) {
32155         LDKChannelDetails this_ptr_conv;
32156         this_ptr_conv.inner = untag_ptr(this_ptr);
32157         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32159         this_ptr_conv.is_owned = false;
32160         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
32161 }
32162
32163 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_channel_shutdown_state"))) TS_ChannelDetails_get_channel_shutdown_state(uint64_t this_ptr) {
32164         LDKChannelDetails this_ptr_conv;
32165         this_ptr_conv.inner = untag_ptr(this_ptr);
32166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32168         this_ptr_conv.is_owned = false;
32169         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
32170         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
32171         uint64_t ret_ref = tag_ptr(ret_copy, true);
32172         return ret_ref;
32173 }
32174
32175 void  __attribute__((export_name("TS_ChannelDetails_set_channel_shutdown_state"))) TS_ChannelDetails_set_channel_shutdown_state(uint64_t this_ptr, uint64_t val) {
32176         LDKChannelDetails this_ptr_conv;
32177         this_ptr_conv.inner = untag_ptr(this_ptr);
32178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32180         this_ptr_conv.is_owned = false;
32181         void* val_ptr = untag_ptr(val);
32182         CHECK_ACCESS(val_ptr);
32183         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
32184         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
32185         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
32186 }
32187
32188 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_usable"))) TS_ChannelDetails_get_is_usable(uint64_t this_ptr) {
32189         LDKChannelDetails this_ptr_conv;
32190         this_ptr_conv.inner = untag_ptr(this_ptr);
32191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32193         this_ptr_conv.is_owned = false;
32194         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
32195         return ret_conv;
32196 }
32197
32198 void  __attribute__((export_name("TS_ChannelDetails_set_is_usable"))) TS_ChannelDetails_set_is_usable(uint64_t this_ptr, jboolean val) {
32199         LDKChannelDetails this_ptr_conv;
32200         this_ptr_conv.inner = untag_ptr(this_ptr);
32201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32203         this_ptr_conv.is_owned = false;
32204         ChannelDetails_set_is_usable(&this_ptr_conv, val);
32205 }
32206
32207 jboolean  __attribute__((export_name("TS_ChannelDetails_get_is_public"))) TS_ChannelDetails_get_is_public(uint64_t this_ptr) {
32208         LDKChannelDetails this_ptr_conv;
32209         this_ptr_conv.inner = untag_ptr(this_ptr);
32210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32212         this_ptr_conv.is_owned = false;
32213         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
32214         return ret_conv;
32215 }
32216
32217 void  __attribute__((export_name("TS_ChannelDetails_set_is_public"))) TS_ChannelDetails_set_is_public(uint64_t this_ptr, jboolean val) {
32218         LDKChannelDetails this_ptr_conv;
32219         this_ptr_conv.inner = untag_ptr(this_ptr);
32220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32222         this_ptr_conv.is_owned = false;
32223         ChannelDetails_set_is_public(&this_ptr_conv, val);
32224 }
32225
32226 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_minimum_msat"))) TS_ChannelDetails_get_inbound_htlc_minimum_msat(uint64_t this_ptr) {
32227         LDKChannelDetails this_ptr_conv;
32228         this_ptr_conv.inner = untag_ptr(this_ptr);
32229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32231         this_ptr_conv.is_owned = false;
32232         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32233         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
32234         uint64_t ret_ref = tag_ptr(ret_copy, true);
32235         return ret_ref;
32236 }
32237
32238 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) {
32239         LDKChannelDetails this_ptr_conv;
32240         this_ptr_conv.inner = untag_ptr(this_ptr);
32241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32243         this_ptr_conv.is_owned = false;
32244         void* val_ptr = untag_ptr(val);
32245         CHECK_ACCESS(val_ptr);
32246         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32247         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32248         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
32249 }
32250
32251 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_htlc_maximum_msat"))) TS_ChannelDetails_get_inbound_htlc_maximum_msat(uint64_t this_ptr) {
32252         LDKChannelDetails this_ptr_conv;
32253         this_ptr_conv.inner = untag_ptr(this_ptr);
32254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32256         this_ptr_conv.is_owned = false;
32257         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32258         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
32259         uint64_t ret_ref = tag_ptr(ret_copy, true);
32260         return ret_ref;
32261 }
32262
32263 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) {
32264         LDKChannelDetails this_ptr_conv;
32265         this_ptr_conv.inner = untag_ptr(this_ptr);
32266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32268         this_ptr_conv.is_owned = false;
32269         void* val_ptr = untag_ptr(val);
32270         CHECK_ACCESS(val_ptr);
32271         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
32272         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
32273         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
32274 }
32275
32276 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_config"))) TS_ChannelDetails_get_config(uint64_t this_ptr) {
32277         LDKChannelDetails this_ptr_conv;
32278         this_ptr_conv.inner = untag_ptr(this_ptr);
32279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32281         this_ptr_conv.is_owned = false;
32282         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
32283         uint64_t ret_ref = 0;
32284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32286         return ret_ref;
32287 }
32288
32289 void  __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDetails_set_config(uint64_t this_ptr, uint64_t val) {
32290         LDKChannelDetails this_ptr_conv;
32291         this_ptr_conv.inner = untag_ptr(this_ptr);
32292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32294         this_ptr_conv.is_owned = false;
32295         LDKChannelConfig val_conv;
32296         val_conv.inner = untag_ptr(val);
32297         val_conv.is_owned = ptr_is_owned(val);
32298         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
32299         val_conv = ChannelConfig_clone(&val_conv);
32300         ChannelDetails_set_config(&this_ptr_conv, val_conv);
32301 }
32302
32303 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) {
32304         LDKThirtyTwoBytes channel_id_arg_ref;
32305         CHECK(channel_id_arg->arr_len == 32);
32306         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
32307         LDKChannelCounterparty counterparty_arg_conv;
32308         counterparty_arg_conv.inner = untag_ptr(counterparty_arg);
32309         counterparty_arg_conv.is_owned = ptr_is_owned(counterparty_arg);
32310         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_arg_conv);
32311         counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
32312         LDKOutPoint funding_txo_arg_conv;
32313         funding_txo_arg_conv.inner = untag_ptr(funding_txo_arg);
32314         funding_txo_arg_conv.is_owned = ptr_is_owned(funding_txo_arg);
32315         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv);
32316         funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
32317         LDKChannelTypeFeatures channel_type_arg_conv;
32318         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
32319         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
32320         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
32321         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
32322         void* short_channel_id_arg_ptr = untag_ptr(short_channel_id_arg);
32323         CHECK_ACCESS(short_channel_id_arg_ptr);
32324         LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr);
32325         short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_arg));
32326         void* outbound_scid_alias_arg_ptr = untag_ptr(outbound_scid_alias_arg);
32327         CHECK_ACCESS(outbound_scid_alias_arg_ptr);
32328         LDKCOption_u64Z outbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(outbound_scid_alias_arg_ptr);
32329         outbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_scid_alias_arg));
32330         void* inbound_scid_alias_arg_ptr = untag_ptr(inbound_scid_alias_arg);
32331         CHECK_ACCESS(inbound_scid_alias_arg_ptr);
32332         LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr);
32333         inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_scid_alias_arg));
32334         void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg);
32335         CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr);
32336         LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr);
32337         LDKU128 user_channel_id_arg_ref;
32338         CHECK(user_channel_id_arg->arr_len == 16);
32339         memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg);
32340         void* feerate_sat_per_1000_weight_arg_ptr = untag_ptr(feerate_sat_per_1000_weight_arg);
32341         CHECK_ACCESS(feerate_sat_per_1000_weight_arg_ptr);
32342         LDKCOption_u32Z feerate_sat_per_1000_weight_arg_conv = *(LDKCOption_u32Z*)(feerate_sat_per_1000_weight_arg_ptr);
32343         feerate_sat_per_1000_weight_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(feerate_sat_per_1000_weight_arg));
32344         void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg);
32345         CHECK_ACCESS(confirmations_required_arg_ptr);
32346         LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr);
32347         confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg));
32348         void* confirmations_arg_ptr = untag_ptr(confirmations_arg);
32349         CHECK_ACCESS(confirmations_arg_ptr);
32350         LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr);
32351         confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg));
32352         void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg);
32353         CHECK_ACCESS(force_close_spend_delay_arg_ptr);
32354         LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr);
32355         force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(force_close_spend_delay_arg));
32356         void* channel_shutdown_state_arg_ptr = untag_ptr(channel_shutdown_state_arg);
32357         CHECK_ACCESS(channel_shutdown_state_arg_ptr);
32358         LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg_conv = *(LDKCOption_ChannelShutdownStateZ*)(channel_shutdown_state_arg_ptr);
32359         channel_shutdown_state_arg_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(channel_shutdown_state_arg));
32360         void* inbound_htlc_minimum_msat_arg_ptr = untag_ptr(inbound_htlc_minimum_msat_arg);
32361         CHECK_ACCESS(inbound_htlc_minimum_msat_arg_ptr);
32362         LDKCOption_u64Z inbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_minimum_msat_arg_ptr);
32363         inbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_minimum_msat_arg));
32364         void* inbound_htlc_maximum_msat_arg_ptr = untag_ptr(inbound_htlc_maximum_msat_arg);
32365         CHECK_ACCESS(inbound_htlc_maximum_msat_arg_ptr);
32366         LDKCOption_u64Z inbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(inbound_htlc_maximum_msat_arg_ptr);
32367         inbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(inbound_htlc_maximum_msat_arg));
32368         LDKChannelConfig config_arg_conv;
32369         config_arg_conv.inner = untag_ptr(config_arg);
32370         config_arg_conv.is_owned = ptr_is_owned(config_arg);
32371         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv);
32372         config_arg_conv = ChannelConfig_clone(&config_arg_conv);
32373         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);
32374         uint64_t ret_ref = 0;
32375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32377         return ret_ref;
32378 }
32379
32380 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
32381         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
32382         uint64_t ret_ref = 0;
32383         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32384         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32385         return ret_ref;
32386 }
32387 int64_t  __attribute__((export_name("TS_ChannelDetails_clone_ptr"))) TS_ChannelDetails_clone_ptr(uint64_t arg) {
32388         LDKChannelDetails arg_conv;
32389         arg_conv.inner = untag_ptr(arg);
32390         arg_conv.is_owned = ptr_is_owned(arg);
32391         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32392         arg_conv.is_owned = false;
32393         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
32394         return ret_conv;
32395 }
32396
32397 uint64_t  __attribute__((export_name("TS_ChannelDetails_clone"))) TS_ChannelDetails_clone(uint64_t orig) {
32398         LDKChannelDetails orig_conv;
32399         orig_conv.inner = untag_ptr(orig);
32400         orig_conv.is_owned = ptr_is_owned(orig);
32401         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32402         orig_conv.is_owned = false;
32403         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
32404         uint64_t ret_ref = 0;
32405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32407         return ret_ref;
32408 }
32409
32410 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_inbound_payment_scid"))) TS_ChannelDetails_get_inbound_payment_scid(uint64_t this_arg) {
32411         LDKChannelDetails this_arg_conv;
32412         this_arg_conv.inner = untag_ptr(this_arg);
32413         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32415         this_arg_conv.is_owned = false;
32416         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32417         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
32418         uint64_t ret_ref = tag_ptr(ret_copy, true);
32419         return ret_ref;
32420 }
32421
32422 uint64_t  __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_scid"))) TS_ChannelDetails_get_outbound_payment_scid(uint64_t this_arg) {
32423         LDKChannelDetails this_arg_conv;
32424         this_arg_conv.inner = untag_ptr(this_arg);
32425         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32427         this_arg_conv.is_owned = false;
32428         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
32429         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
32430         uint64_t ret_ref = tag_ptr(ret_copy, true);
32431         return ret_ref;
32432 }
32433
32434 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_clone"))) TS_ChannelShutdownState_clone(uint64_t orig) {
32435         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
32436         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_clone(orig_conv));
32437         return ret_conv;
32438 }
32439
32440 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_not_shutting_down"))) TS_ChannelShutdownState_not_shutting_down() {
32441         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_not_shutting_down());
32442         return ret_conv;
32443 }
32444
32445 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_initiated"))) TS_ChannelShutdownState_shutdown_initiated() {
32446         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_initiated());
32447         return ret_conv;
32448 }
32449
32450 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_resolving_htlcs"))) TS_ChannelShutdownState_resolving_htlcs() {
32451         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_resolving_htlcs());
32452         return ret_conv;
32453 }
32454
32455 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_negotiating_closing_fee"))) TS_ChannelShutdownState_negotiating_closing_fee() {
32456         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_negotiating_closing_fee());
32457         return ret_conv;
32458 }
32459
32460 uint32_t  __attribute__((export_name("TS_ChannelShutdownState_shutdown_complete"))) TS_ChannelShutdownState_shutdown_complete() {
32461         uint32_t ret_conv = LDKChannelShutdownState_to_js(ChannelShutdownState_shutdown_complete());
32462         return ret_conv;
32463 }
32464
32465 jboolean  __attribute__((export_name("TS_ChannelShutdownState_eq"))) TS_ChannelShutdownState_eq(uint64_t a, uint64_t b) {
32466         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
32467         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
32468         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
32469         return ret_conv;
32470 }
32471
32472 void  __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_free(uint64_t this_ptr) {
32473         if (!ptr_is_owned(this_ptr)) return;
32474         void* this_ptr_ptr = untag_ptr(this_ptr);
32475         CHECK_ACCESS(this_ptr_ptr);
32476         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
32477         FREE(untag_ptr(this_ptr));
32478         RecentPaymentDetails_free(this_ptr_conv);
32479 }
32480
32481 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
32482         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32483         *ret_copy = RecentPaymentDetails_clone(arg);
32484         uint64_t ret_ref = tag_ptr(ret_copy, true);
32485         return ret_ref;
32486 }
32487 int64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) {
32488         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
32489         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
32490         return ret_conv;
32491 }
32492
32493 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) {
32494         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
32495         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32496         *ret_copy = RecentPaymentDetails_clone(orig_conv);
32497         uint64_t ret_ref = tag_ptr(ret_copy, true);
32498         return ret_ref;
32499 }
32500
32501 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_hash, int64_t total_msat) {
32502         LDKThirtyTwoBytes payment_hash_ref;
32503         CHECK(payment_hash->arr_len == 32);
32504         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32505         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32506         *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat);
32507         uint64_t ret_ref = tag_ptr(ret_copy, true);
32508         return ret_ref;
32509 }
32510
32511 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(uint64_t payment_hash) {
32512         void* payment_hash_ptr = untag_ptr(payment_hash);
32513         CHECK_ACCESS(payment_hash_ptr);
32514         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
32515         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
32516         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32517         *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_conv);
32518         uint64_t ret_ref = tag_ptr(ret_copy, true);
32519         return ret_ref;
32520 }
32521
32522 uint64_t  __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_hash) {
32523         LDKThirtyTwoBytes payment_hash_ref;
32524         CHECK(payment_hash->arr_len == 32);
32525         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
32526         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32527         *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref);
32528         uint64_t ret_ref = tag_ptr(ret_copy, true);
32529         return ret_ref;
32530 }
32531
32532 void  __attribute__((export_name("TS_PhantomRouteHints_free"))) TS_PhantomRouteHints_free(uint64_t this_obj) {
32533         LDKPhantomRouteHints this_obj_conv;
32534         this_obj_conv.inner = untag_ptr(this_obj);
32535         this_obj_conv.is_owned = ptr_is_owned(this_obj);
32536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
32537         PhantomRouteHints_free(this_obj_conv);
32538 }
32539
32540 uint64_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_channels"))) TS_PhantomRouteHints_get_channels(uint64_t this_ptr) {
32541         LDKPhantomRouteHints this_ptr_conv;
32542         this_ptr_conv.inner = untag_ptr(this_ptr);
32543         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32545         this_ptr_conv.is_owned = false;
32546         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
32547         uint64_tArray ret_arr = NULL;
32548         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32549         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32550         for (size_t q = 0; q < ret_var.datalen; q++) {
32551                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
32552                 uint64_t ret_conv_16_ref = 0;
32553                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32554                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32555                 ret_arr_ptr[q] = ret_conv_16_ref;
32556         }
32557         
32558         FREE(ret_var.data);
32559         return ret_arr;
32560 }
32561
32562 void  __attribute__((export_name("TS_PhantomRouteHints_set_channels"))) TS_PhantomRouteHints_set_channels(uint64_t this_ptr, uint64_tArray val) {
32563         LDKPhantomRouteHints this_ptr_conv;
32564         this_ptr_conv.inner = untag_ptr(this_ptr);
32565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32567         this_ptr_conv.is_owned = false;
32568         LDKCVec_ChannelDetailsZ val_constr;
32569         val_constr.datalen = val->arr_len;
32570         if (val_constr.datalen > 0)
32571                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
32572         else
32573                 val_constr.data = NULL;
32574         uint64_t* val_vals = val->elems;
32575         for (size_t q = 0; q < val_constr.datalen; q++) {
32576                 uint64_t val_conv_16 = val_vals[q];
32577                 LDKChannelDetails val_conv_16_conv;
32578                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
32579                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
32580                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
32581                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
32582                 val_constr.data[q] = val_conv_16_conv;
32583         }
32584         FREE(val);
32585         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
32586 }
32587
32588 int64_t  __attribute__((export_name("TS_PhantomRouteHints_get_phantom_scid"))) TS_PhantomRouteHints_get_phantom_scid(uint64_t this_ptr) {
32589         LDKPhantomRouteHints this_ptr_conv;
32590         this_ptr_conv.inner = untag_ptr(this_ptr);
32591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32593         this_ptr_conv.is_owned = false;
32594         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
32595         return ret_conv;
32596 }
32597
32598 void  __attribute__((export_name("TS_PhantomRouteHints_set_phantom_scid"))) TS_PhantomRouteHints_set_phantom_scid(uint64_t this_ptr, int64_t val) {
32599         LDKPhantomRouteHints this_ptr_conv;
32600         this_ptr_conv.inner = untag_ptr(this_ptr);
32601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32603         this_ptr_conv.is_owned = false;
32604         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
32605 }
32606
32607 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_get_real_node_pubkey"))) TS_PhantomRouteHints_get_real_node_pubkey(uint64_t this_ptr) {
32608         LDKPhantomRouteHints this_ptr_conv;
32609         this_ptr_conv.inner = untag_ptr(this_ptr);
32610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32612         this_ptr_conv.is_owned = false;
32613         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
32614         memcpy(ret_arr->elems, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form, 33);
32615         return ret_arr;
32616 }
32617
32618 void  __attribute__((export_name("TS_PhantomRouteHints_set_real_node_pubkey"))) TS_PhantomRouteHints_set_real_node_pubkey(uint64_t this_ptr, int8_tArray val) {
32619         LDKPhantomRouteHints this_ptr_conv;
32620         this_ptr_conv.inner = untag_ptr(this_ptr);
32621         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
32622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
32623         this_ptr_conv.is_owned = false;
32624         LDKPublicKey val_ref;
32625         CHECK(val->arr_len == 33);
32626         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
32627         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
32628 }
32629
32630 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) {
32631         LDKCVec_ChannelDetailsZ channels_arg_constr;
32632         channels_arg_constr.datalen = channels_arg->arr_len;
32633         if (channels_arg_constr.datalen > 0)
32634                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
32635         else
32636                 channels_arg_constr.data = NULL;
32637         uint64_t* channels_arg_vals = channels_arg->elems;
32638         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
32639                 uint64_t channels_arg_conv_16 = channels_arg_vals[q];
32640                 LDKChannelDetails channels_arg_conv_16_conv;
32641                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
32642                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
32643                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
32644                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
32645                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
32646         }
32647         FREE(channels_arg);
32648         LDKPublicKey real_node_pubkey_arg_ref;
32649         CHECK(real_node_pubkey_arg->arr_len == 33);
32650         memcpy(real_node_pubkey_arg_ref.compressed_form, real_node_pubkey_arg->elems, 33); FREE(real_node_pubkey_arg);
32651         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
32652         uint64_t ret_ref = 0;
32653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32655         return ret_ref;
32656 }
32657
32658 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
32659         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
32660         uint64_t ret_ref = 0;
32661         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32662         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32663         return ret_ref;
32664 }
32665 int64_t  __attribute__((export_name("TS_PhantomRouteHints_clone_ptr"))) TS_PhantomRouteHints_clone_ptr(uint64_t arg) {
32666         LDKPhantomRouteHints arg_conv;
32667         arg_conv.inner = untag_ptr(arg);
32668         arg_conv.is_owned = ptr_is_owned(arg);
32669         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
32670         arg_conv.is_owned = false;
32671         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
32672         return ret_conv;
32673 }
32674
32675 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomRouteHints_clone(uint64_t orig) {
32676         LDKPhantomRouteHints orig_conv;
32677         orig_conv.inner = untag_ptr(orig);
32678         orig_conv.is_owned = ptr_is_owned(orig);
32679         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
32680         orig_conv.is_owned = false;
32681         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
32682         uint64_t ret_ref = 0;
32683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32685         return ret_ref;
32686 }
32687
32688 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) {
32689         void* fee_est_ptr = untag_ptr(fee_est);
32690         CHECK_ACCESS(fee_est_ptr);
32691         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
32692         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
32693                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32694                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
32695         }
32696         void* chain_monitor_ptr = untag_ptr(chain_monitor);
32697         CHECK_ACCESS(chain_monitor_ptr);
32698         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
32699         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
32700                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32701                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
32702         }
32703         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
32704         CHECK_ACCESS(tx_broadcaster_ptr);
32705         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
32706         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
32707                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32708                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
32709         }
32710         void* router_ptr = untag_ptr(router);
32711         CHECK_ACCESS(router_ptr);
32712         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
32713         if (router_conv.free == LDKRouter_JCalls_free) {
32714                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32715                 LDKRouter_JCalls_cloned(&router_conv);
32716         }
32717         void* logger_ptr = untag_ptr(logger);
32718         CHECK_ACCESS(logger_ptr);
32719         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
32720         if (logger_conv.free == LDKLogger_JCalls_free) {
32721                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32722                 LDKLogger_JCalls_cloned(&logger_conv);
32723         }
32724         void* entropy_source_ptr = untag_ptr(entropy_source);
32725         CHECK_ACCESS(entropy_source_ptr);
32726         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
32727         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
32728                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32729                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
32730         }
32731         void* node_signer_ptr = untag_ptr(node_signer);
32732         CHECK_ACCESS(node_signer_ptr);
32733         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
32734         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
32735                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32736                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
32737         }
32738         void* signer_provider_ptr = untag_ptr(signer_provider);
32739         CHECK_ACCESS(signer_provider_ptr);
32740         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
32741         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
32742                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32743                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
32744         }
32745         LDKUserConfig config_conv;
32746         config_conv.inner = untag_ptr(config);
32747         config_conv.is_owned = ptr_is_owned(config);
32748         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
32749         config_conv = UserConfig_clone(&config_conv);
32750         LDKChainParameters params_conv;
32751         params_conv.inner = untag_ptr(params);
32752         params_conv.is_owned = ptr_is_owned(params);
32753         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
32754         params_conv = ChainParameters_clone(&params_conv);
32755         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);
32756         uint64_t ret_ref = 0;
32757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32759         return ret_ref;
32760 }
32761
32762 uint64_t  __attribute__((export_name("TS_ChannelManager_get_current_default_configuration"))) TS_ChannelManager_get_current_default_configuration(uint64_t this_arg) {
32763         LDKChannelManager this_arg_conv;
32764         this_arg_conv.inner = untag_ptr(this_arg);
32765         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32767         this_arg_conv.is_owned = false;
32768         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
32769         uint64_t ret_ref = 0;
32770         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
32771         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
32772         return ret_ref;
32773 }
32774
32775 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) {
32776         LDKChannelManager this_arg_conv;
32777         this_arg_conv.inner = untag_ptr(this_arg);
32778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32780         this_arg_conv.is_owned = false;
32781         LDKPublicKey their_network_key_ref;
32782         CHECK(their_network_key->arr_len == 33);
32783         memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key);
32784         LDKU128 user_channel_id_ref;
32785         CHECK(user_channel_id->arr_len == 16);
32786         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
32787         LDKUserConfig override_config_conv;
32788         override_config_conv.inner = untag_ptr(override_config);
32789         override_config_conv.is_owned = ptr_is_owned(override_config);
32790         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
32791         override_config_conv = UserConfig_clone(&override_config_conv);
32792         LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
32793         *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv);
32794         return tag_ptr(ret_conv, true);
32795 }
32796
32797 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_channels"))) TS_ChannelManager_list_channels(uint64_t this_arg) {
32798         LDKChannelManager this_arg_conv;
32799         this_arg_conv.inner = untag_ptr(this_arg);
32800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32802         this_arg_conv.is_owned = false;
32803         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
32804         uint64_tArray ret_arr = NULL;
32805         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32806         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32807         for (size_t q = 0; q < ret_var.datalen; q++) {
32808                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
32809                 uint64_t ret_conv_16_ref = 0;
32810                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32811                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32812                 ret_arr_ptr[q] = ret_conv_16_ref;
32813         }
32814         
32815         FREE(ret_var.data);
32816         return ret_arr;
32817 }
32818
32819 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_usable_channels"))) TS_ChannelManager_list_usable_channels(uint64_t this_arg) {
32820         LDKChannelManager this_arg_conv;
32821         this_arg_conv.inner = untag_ptr(this_arg);
32822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32824         this_arg_conv.is_owned = false;
32825         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
32826         uint64_tArray ret_arr = NULL;
32827         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32828         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32829         for (size_t q = 0; q < ret_var.datalen; q++) {
32830                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
32831                 uint64_t ret_conv_16_ref = 0;
32832                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32833                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32834                 ret_arr_ptr[q] = ret_conv_16_ref;
32835         }
32836         
32837         FREE(ret_var.data);
32838         return ret_arr;
32839 }
32840
32841 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) {
32842         LDKChannelManager this_arg_conv;
32843         this_arg_conv.inner = untag_ptr(this_arg);
32844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32846         this_arg_conv.is_owned = false;
32847         LDKPublicKey counterparty_node_id_ref;
32848         CHECK(counterparty_node_id->arr_len == 33);
32849         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32850         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
32851         uint64_tArray ret_arr = NULL;
32852         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32853         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32854         for (size_t q = 0; q < ret_var.datalen; q++) {
32855                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
32856                 uint64_t ret_conv_16_ref = 0;
32857                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
32858                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
32859                 ret_arr_ptr[q] = ret_conv_16_ref;
32860         }
32861         
32862         FREE(ret_var.data);
32863         return ret_arr;
32864 }
32865
32866 uint64_tArray  __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(uint64_t this_arg) {
32867         LDKChannelManager this_arg_conv;
32868         this_arg_conv.inner = untag_ptr(this_arg);
32869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32871         this_arg_conv.is_owned = false;
32872         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
32873         uint64_tArray ret_arr = NULL;
32874         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
32875         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
32876         for (size_t w = 0; w < ret_var.datalen; w++) {
32877                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
32878                 *ret_conv_22_copy = ret_var.data[w];
32879                 uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
32880                 ret_arr_ptr[w] = ret_conv_22_ref;
32881         }
32882         
32883         FREE(ret_var.data);
32884         return ret_arr;
32885 }
32886
32887 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) {
32888         LDKChannelManager this_arg_conv;
32889         this_arg_conv.inner = untag_ptr(this_arg);
32890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32892         this_arg_conv.is_owned = false;
32893         uint8_t channel_id_arr[32];
32894         CHECK(channel_id->arr_len == 32);
32895         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
32896         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
32897         LDKPublicKey counterparty_node_id_ref;
32898         CHECK(counterparty_node_id->arr_len == 33);
32899         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32900         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32901         *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
32902         return tag_ptr(ret_conv, true);
32903 }
32904
32905 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) {
32906         LDKChannelManager this_arg_conv;
32907         this_arg_conv.inner = untag_ptr(this_arg);
32908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32910         this_arg_conv.is_owned = false;
32911         uint8_t channel_id_arr[32];
32912         CHECK(channel_id->arr_len == 32);
32913         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
32914         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
32915         LDKPublicKey counterparty_node_id_ref;
32916         CHECK(counterparty_node_id->arr_len == 33);
32917         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32918         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
32919         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
32920         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
32921         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
32922         LDKShutdownScript shutdown_script_conv;
32923         shutdown_script_conv.inner = untag_ptr(shutdown_script);
32924         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
32925         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
32926         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
32927         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32928         *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);
32929         return tag_ptr(ret_conv, true);
32930 }
32931
32932 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) {
32933         LDKChannelManager this_arg_conv;
32934         this_arg_conv.inner = untag_ptr(this_arg);
32935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32937         this_arg_conv.is_owned = false;
32938         uint8_t channel_id_arr[32];
32939         CHECK(channel_id->arr_len == 32);
32940         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
32941         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
32942         LDKPublicKey counterparty_node_id_ref;
32943         CHECK(counterparty_node_id->arr_len == 33);
32944         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32945         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32946         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
32947         return tag_ptr(ret_conv, true);
32948 }
32949
32950 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) {
32951         LDKChannelManager this_arg_conv;
32952         this_arg_conv.inner = untag_ptr(this_arg);
32953         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32955         this_arg_conv.is_owned = false;
32956         uint8_t channel_id_arr[32];
32957         CHECK(channel_id->arr_len == 32);
32958         memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id);
32959         uint8_t (*channel_id_ref)[32] = &channel_id_arr;
32960         LDKPublicKey counterparty_node_id_ref;
32961         CHECK(counterparty_node_id->arr_len == 33);
32962         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
32963         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
32964         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, channel_id_ref, counterparty_node_id_ref);
32965         return tag_ptr(ret_conv, true);
32966 }
32967
32968 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) {
32969         LDKChannelManager this_arg_conv;
32970         this_arg_conv.inner = untag_ptr(this_arg);
32971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32973         this_arg_conv.is_owned = false;
32974         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
32975 }
32976
32977 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) {
32978         LDKChannelManager this_arg_conv;
32979         this_arg_conv.inner = untag_ptr(this_arg);
32980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32982         this_arg_conv.is_owned = false;
32983         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
32984 }
32985
32986 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) {
32987         LDKChannelManager this_arg_conv;
32988         this_arg_conv.inner = untag_ptr(this_arg);
32989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
32990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
32991         this_arg_conv.is_owned = false;
32992         LDKRoute route_conv;
32993         route_conv.inner = untag_ptr(route);
32994         route_conv.is_owned = ptr_is_owned(route);
32995         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
32996         route_conv.is_owned = false;
32997         LDKThirtyTwoBytes payment_hash_ref;
32998         CHECK(payment_hash->arr_len == 32);
32999         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
33000         LDKRecipientOnionFields recipient_onion_conv;
33001         recipient_onion_conv.inner = untag_ptr(recipient_onion);
33002         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
33003         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
33004         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
33005         LDKThirtyTwoBytes payment_id_ref;
33006         CHECK(payment_id->arr_len == 32);
33007         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33008         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
33009         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
33010         return tag_ptr(ret_conv, true);
33011 }
33012
33013 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) {
33014         LDKChannelManager this_arg_conv;
33015         this_arg_conv.inner = untag_ptr(this_arg);
33016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33018         this_arg_conv.is_owned = false;
33019         LDKThirtyTwoBytes payment_hash_ref;
33020         CHECK(payment_hash->arr_len == 32);
33021         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
33022         LDKRecipientOnionFields recipient_onion_conv;
33023         recipient_onion_conv.inner = untag_ptr(recipient_onion);
33024         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
33025         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
33026         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
33027         LDKThirtyTwoBytes payment_id_ref;
33028         CHECK(payment_id->arr_len == 32);
33029         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33030         LDKRouteParameters route_params_conv;
33031         route_params_conv.inner = untag_ptr(route_params);
33032         route_params_conv.is_owned = ptr_is_owned(route_params);
33033         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
33034         route_params_conv = RouteParameters_clone(&route_params_conv);
33035         void* retry_strategy_ptr = untag_ptr(retry_strategy);
33036         CHECK_ACCESS(retry_strategy_ptr);
33037         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
33038         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
33039         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
33040         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
33041         return tag_ptr(ret_conv, true);
33042 }
33043
33044 void  __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_ChannelManager_abandon_payment(uint64_t this_arg, int8_tArray payment_id) {
33045         LDKChannelManager this_arg_conv;
33046         this_arg_conv.inner = untag_ptr(this_arg);
33047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33049         this_arg_conv.is_owned = false;
33050         LDKThirtyTwoBytes payment_id_ref;
33051         CHECK(payment_id->arr_len == 32);
33052         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33053         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
33054 }
33055
33056 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) {
33057         LDKChannelManager this_arg_conv;
33058         this_arg_conv.inner = untag_ptr(this_arg);
33059         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33061         this_arg_conv.is_owned = false;
33062         LDKRoute route_conv;
33063         route_conv.inner = untag_ptr(route);
33064         route_conv.is_owned = ptr_is_owned(route);
33065         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
33066         route_conv.is_owned = false;
33067         void* payment_preimage_ptr = untag_ptr(payment_preimage);
33068         CHECK_ACCESS(payment_preimage_ptr);
33069         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
33070         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
33071         LDKRecipientOnionFields recipient_onion_conv;
33072         recipient_onion_conv.inner = untag_ptr(recipient_onion);
33073         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
33074         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
33075         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
33076         LDKThirtyTwoBytes payment_id_ref;
33077         CHECK(payment_id->arr_len == 32);
33078         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33079         LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
33080         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
33081         return tag_ptr(ret_conv, true);
33082 }
33083
33084 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) {
33085         LDKChannelManager this_arg_conv;
33086         this_arg_conv.inner = untag_ptr(this_arg);
33087         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33089         this_arg_conv.is_owned = false;
33090         void* payment_preimage_ptr = untag_ptr(payment_preimage);
33091         CHECK_ACCESS(payment_preimage_ptr);
33092         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
33093         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
33094         LDKRecipientOnionFields recipient_onion_conv;
33095         recipient_onion_conv.inner = untag_ptr(recipient_onion);
33096         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
33097         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
33098         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
33099         LDKThirtyTwoBytes payment_id_ref;
33100         CHECK(payment_id->arr_len == 32);
33101         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
33102         LDKRouteParameters route_params_conv;
33103         route_params_conv.inner = untag_ptr(route_params);
33104         route_params_conv.is_owned = ptr_is_owned(route_params);
33105         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
33106         route_params_conv = RouteParameters_clone(&route_params_conv);
33107         void* retry_strategy_ptr = untag_ptr(retry_strategy);
33108         CHECK_ACCESS(retry_strategy_ptr);
33109         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
33110         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
33111         LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ");
33112         *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);
33113         return tag_ptr(ret_conv, true);
33114 }
33115
33116 uint64_t  __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_t path) {
33117         LDKChannelManager this_arg_conv;
33118         this_arg_conv.inner = untag_ptr(this_arg);
33119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33121         this_arg_conv.is_owned = false;
33122         LDKPath path_conv;
33123         path_conv.inner = untag_ptr(path);
33124         path_conv.is_owned = ptr_is_owned(path);
33125         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
33126         path_conv = Path_clone(&path_conv);
33127         LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
33128         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
33129         return tag_ptr(ret_conv, true);
33130 }
33131
33132 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) {
33133         LDKChannelManager this_arg_conv;
33134         this_arg_conv.inner = untag_ptr(this_arg);
33135         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33137         this_arg_conv.is_owned = false;
33138         uint8_t temporary_channel_id_arr[32];
33139         CHECK(temporary_channel_id->arr_len == 32);
33140         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
33141         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
33142         LDKPublicKey counterparty_node_id_ref;
33143         CHECK(counterparty_node_id->arr_len == 33);
33144         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33145         LDKTransaction funding_transaction_ref;
33146         funding_transaction_ref.datalen = funding_transaction->arr_len;
33147         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
33148         memcpy(funding_transaction_ref.data, funding_transaction->elems, funding_transaction_ref.datalen); FREE(funding_transaction);
33149         funding_transaction_ref.data_is_owned = true;
33150         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33151         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, funding_transaction_ref);
33152         return tag_ptr(ret_conv, true);
33153 }
33154
33155 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) {
33156         LDKChannelManager this_arg_conv;
33157         this_arg_conv.inner = untag_ptr(this_arg);
33158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33160         this_arg_conv.is_owned = false;
33161         LDKPublicKey counterparty_node_id_ref;
33162         CHECK(counterparty_node_id->arr_len == 33);
33163         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33164         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
33165         channel_ids_constr.datalen = channel_ids->arr_len;
33166         if (channel_ids_constr.datalen > 0)
33167                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
33168         else
33169                 channel_ids_constr.data = NULL;
33170         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
33171         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
33172                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
33173                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
33174                 CHECK(channel_ids_conv_12->arr_len == 32);
33175                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
33176                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
33177         }
33178         FREE(channel_ids);
33179         LDKChannelConfigUpdate config_update_conv;
33180         config_update_conv.inner = untag_ptr(config_update);
33181         config_update_conv.is_owned = ptr_is_owned(config_update);
33182         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
33183         config_update_conv.is_owned = false;
33184         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33185         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
33186         return tag_ptr(ret_conv, true);
33187 }
33188
33189 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) {
33190         LDKChannelManager this_arg_conv;
33191         this_arg_conv.inner = untag_ptr(this_arg);
33192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33194         this_arg_conv.is_owned = false;
33195         LDKPublicKey counterparty_node_id_ref;
33196         CHECK(counterparty_node_id->arr_len == 33);
33197         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33198         LDKCVec_ThirtyTwoBytesZ channel_ids_constr;
33199         channel_ids_constr.datalen = channel_ids->arr_len;
33200         if (channel_ids_constr.datalen > 0)
33201                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
33202         else
33203                 channel_ids_constr.data = NULL;
33204         int8_tArray* channel_ids_vals = (void*) channel_ids->elems;
33205         for (size_t m = 0; m < channel_ids_constr.datalen; m++) {
33206                 int8_tArray channel_ids_conv_12 = channel_ids_vals[m];
33207                 LDKThirtyTwoBytes channel_ids_conv_12_ref;
33208                 CHECK(channel_ids_conv_12->arr_len == 32);
33209                 memcpy(channel_ids_conv_12_ref.data, channel_ids_conv_12->elems, 32); FREE(channel_ids_conv_12);
33210                 channel_ids_constr.data[m] = channel_ids_conv_12_ref;
33211         }
33212         FREE(channel_ids);
33213         LDKChannelConfig config_conv;
33214         config_conv.inner = untag_ptr(config);
33215         config_conv.is_owned = ptr_is_owned(config);
33216         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
33217         config_conv.is_owned = false;
33218         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33219         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
33220         return tag_ptr(ret_conv, true);
33221 }
33222
33223 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) {
33224         LDKChannelManager this_arg_conv;
33225         this_arg_conv.inner = untag_ptr(this_arg);
33226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33228         this_arg_conv.is_owned = false;
33229         LDKThirtyTwoBytes intercept_id_ref;
33230         CHECK(intercept_id->arr_len == 32);
33231         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
33232         uint8_t next_hop_channel_id_arr[32];
33233         CHECK(next_hop_channel_id->arr_len == 32);
33234         memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id);
33235         uint8_t (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr;
33236         LDKPublicKey next_node_id_ref;
33237         CHECK(next_node_id->arr_len == 33);
33238         memcpy(next_node_id_ref.compressed_form, next_node_id->elems, 33); FREE(next_node_id);
33239         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33240         *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);
33241         return tag_ptr(ret_conv, true);
33242 }
33243
33244 uint64_t  __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) {
33245         LDKChannelManager this_arg_conv;
33246         this_arg_conv.inner = untag_ptr(this_arg);
33247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33249         this_arg_conv.is_owned = false;
33250         LDKThirtyTwoBytes intercept_id_ref;
33251         CHECK(intercept_id->arr_len == 32);
33252         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
33253         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33254         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
33255         return tag_ptr(ret_conv, true);
33256 }
33257
33258 void  __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) {
33259         LDKChannelManager this_arg_conv;
33260         this_arg_conv.inner = untag_ptr(this_arg);
33261         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33263         this_arg_conv.is_owned = false;
33264         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
33265 }
33266
33267 void  __attribute__((export_name("TS_ChannelManager_timer_tick_occurred"))) TS_ChannelManager_timer_tick_occurred(uint64_t this_arg) {
33268         LDKChannelManager this_arg_conv;
33269         this_arg_conv.inner = untag_ptr(this_arg);
33270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33272         this_arg_conv.is_owned = false;
33273         ChannelManager_timer_tick_occurred(&this_arg_conv);
33274 }
33275
33276 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_ChannelManager_fail_htlc_backwards(uint64_t this_arg, int8_tArray payment_hash) {
33277         LDKChannelManager this_arg_conv;
33278         this_arg_conv.inner = untag_ptr(this_arg);
33279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33281         this_arg_conv.is_owned = false;
33282         uint8_t payment_hash_arr[32];
33283         CHECK(payment_hash->arr_len == 32);
33284         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
33285         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
33286         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
33287 }
33288
33289 void  __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards_with_reason"))) TS_ChannelManager_fail_htlc_backwards_with_reason(uint64_t this_arg, int8_tArray payment_hash, uint32_t failure_code) {
33290         LDKChannelManager this_arg_conv;
33291         this_arg_conv.inner = untag_ptr(this_arg);
33292         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33294         this_arg_conv.is_owned = false;
33295         uint8_t payment_hash_arr[32];
33296         CHECK(payment_hash->arr_len == 32);
33297         memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash);
33298         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
33299         LDKFailureCode failure_code_conv = LDKFailureCode_from_js(failure_code);
33300         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
33301 }
33302
33303 void  __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) {
33304         LDKChannelManager this_arg_conv;
33305         this_arg_conv.inner = untag_ptr(this_arg);
33306         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33308         this_arg_conv.is_owned = false;
33309         LDKThirtyTwoBytes payment_preimage_ref;
33310         CHECK(payment_preimage->arr_len == 32);
33311         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
33312         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
33313 }
33314
33315 int8_tArray  __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) TS_ChannelManager_get_our_node_id(uint64_t this_arg) {
33316         LDKChannelManager this_arg_conv;
33317         this_arg_conv.inner = untag_ptr(this_arg);
33318         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33320         this_arg_conv.is_owned = false;
33321         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
33322         memcpy(ret_arr->elems, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
33323         return ret_arr;
33324 }
33325
33326 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) {
33327         LDKChannelManager this_arg_conv;
33328         this_arg_conv.inner = untag_ptr(this_arg);
33329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33331         this_arg_conv.is_owned = false;
33332         uint8_t temporary_channel_id_arr[32];
33333         CHECK(temporary_channel_id->arr_len == 32);
33334         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
33335         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
33336         LDKPublicKey counterparty_node_id_ref;
33337         CHECK(counterparty_node_id->arr_len == 33);
33338         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33339         LDKU128 user_channel_id_ref;
33340         CHECK(user_channel_id->arr_len == 16);
33341         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
33342         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33343         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref);
33344         return tag_ptr(ret_conv, true);
33345 }
33346
33347 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) {
33348         LDKChannelManager this_arg_conv;
33349         this_arg_conv.inner = untag_ptr(this_arg);
33350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33352         this_arg_conv.is_owned = false;
33353         uint8_t temporary_channel_id_arr[32];
33354         CHECK(temporary_channel_id->arr_len == 32);
33355         memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
33356         uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
33357         LDKPublicKey counterparty_node_id_ref;
33358         CHECK(counterparty_node_id->arr_len == 33);
33359         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
33360         LDKU128 user_channel_id_ref;
33361         CHECK(user_channel_id->arr_len == 16);
33362         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
33363         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
33364         *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);
33365         return tag_ptr(ret_conv, true);
33366 }
33367
33368 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) {
33369         LDKChannelManager this_arg_conv;
33370         this_arg_conv.inner = untag_ptr(this_arg);
33371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33373         this_arg_conv.is_owned = false;
33374         void* min_value_msat_ptr = untag_ptr(min_value_msat);
33375         CHECK_ACCESS(min_value_msat_ptr);
33376         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
33377         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
33378         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
33379         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
33380         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
33381         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
33382         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
33383         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
33384         return tag_ptr(ret_conv, true);
33385 }
33386
33387 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) {
33388         LDKChannelManager this_arg_conv;
33389         this_arg_conv.inner = untag_ptr(this_arg);
33390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33392         this_arg_conv.is_owned = false;
33393         LDKThirtyTwoBytes payment_hash_ref;
33394         CHECK(payment_hash->arr_len == 32);
33395         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
33396         void* min_value_msat_ptr = untag_ptr(min_value_msat);
33397         CHECK_ACCESS(min_value_msat_ptr);
33398         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
33399         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
33400         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
33401         CHECK_ACCESS(min_final_cltv_expiry_ptr);
33402         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
33403         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
33404         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
33405         *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);
33406         return tag_ptr(ret_conv, true);
33407 }
33408
33409 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) {
33410         LDKChannelManager this_arg_conv;
33411         this_arg_conv.inner = untag_ptr(this_arg);
33412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33414         this_arg_conv.is_owned = false;
33415         LDKThirtyTwoBytes payment_hash_ref;
33416         CHECK(payment_hash->arr_len == 32);
33417         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
33418         LDKThirtyTwoBytes payment_secret_ref;
33419         CHECK(payment_secret->arr_len == 32);
33420         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
33421         LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ");
33422         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
33423         return tag_ptr(ret_conv, true);
33424 }
33425
33426 int64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_scid"))) TS_ChannelManager_get_phantom_scid(uint64_t this_arg) {
33427         LDKChannelManager this_arg_conv;
33428         this_arg_conv.inner = untag_ptr(this_arg);
33429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33431         this_arg_conv.is_owned = false;
33432         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
33433         return ret_conv;
33434 }
33435
33436 uint64_t  __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints"))) TS_ChannelManager_get_phantom_route_hints(uint64_t this_arg) {
33437         LDKChannelManager this_arg_conv;
33438         this_arg_conv.inner = untag_ptr(this_arg);
33439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33441         this_arg_conv.is_owned = false;
33442         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
33443         uint64_t ret_ref = 0;
33444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33446         return ret_ref;
33447 }
33448
33449 int64_t  __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) {
33450         LDKChannelManager this_arg_conv;
33451         this_arg_conv.inner = untag_ptr(this_arg);
33452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33454         this_arg_conv.is_owned = false;
33455         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
33456         return ret_conv;
33457 }
33458
33459 uint64_t  __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) {
33460         LDKChannelManager this_arg_conv;
33461         this_arg_conv.inner = untag_ptr(this_arg);
33462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33464         this_arg_conv.is_owned = false;
33465         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
33466         uint64_t ret_ref = 0;
33467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33469         return ret_ref;
33470 }
33471
33472 uint64_t  __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) {
33473         LDKChannelManager this_arg_conv;
33474         this_arg_conv.inner = untag_ptr(this_arg);
33475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33477         this_arg_conv.is_owned = false;
33478         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
33479         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
33480         return tag_ptr(ret_ret, true);
33481 }
33482
33483 uint64_t  __attribute__((export_name("TS_ChannelManager_as_EventsProvider"))) TS_ChannelManager_as_EventsProvider(uint64_t this_arg) {
33484         LDKChannelManager this_arg_conv;
33485         this_arg_conv.inner = untag_ptr(this_arg);
33486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33488         this_arg_conv.is_owned = false;
33489         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
33490         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
33491         return tag_ptr(ret_ret, true);
33492 }
33493
33494 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Listen"))) TS_ChannelManager_as_Listen(uint64_t this_arg) {
33495         LDKChannelManager this_arg_conv;
33496         this_arg_conv.inner = untag_ptr(this_arg);
33497         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33499         this_arg_conv.is_owned = false;
33500         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
33501         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
33502         return tag_ptr(ret_ret, true);
33503 }
33504
33505 uint64_t  __attribute__((export_name("TS_ChannelManager_as_Confirm"))) TS_ChannelManager_as_Confirm(uint64_t this_arg) {
33506         LDKChannelManager this_arg_conv;
33507         this_arg_conv.inner = untag_ptr(this_arg);
33508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33510         this_arg_conv.is_owned = false;
33511         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
33512         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
33513         return tag_ptr(ret_ret, true);
33514 }
33515
33516 uint64_t  __attribute__((export_name("TS_ChannelManager_get_persistable_update_future"))) TS_ChannelManager_get_persistable_update_future(uint64_t this_arg) {
33517         LDKChannelManager this_arg_conv;
33518         this_arg_conv.inner = untag_ptr(this_arg);
33519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33521         this_arg_conv.is_owned = false;
33522         LDKFuture ret_var = ChannelManager_get_persistable_update_future(&this_arg_conv);
33523         uint64_t ret_ref = 0;
33524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33526         return ret_ref;
33527 }
33528
33529 uint64_t  __attribute__((export_name("TS_ChannelManager_current_best_block"))) TS_ChannelManager_current_best_block(uint64_t this_arg) {
33530         LDKChannelManager this_arg_conv;
33531         this_arg_conv.inner = untag_ptr(this_arg);
33532         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33534         this_arg_conv.is_owned = false;
33535         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
33536         uint64_t ret_ref = 0;
33537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33539         return ret_ref;
33540 }
33541
33542 uint64_t  __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(uint64_t this_arg) {
33543         LDKChannelManager this_arg_conv;
33544         this_arg_conv.inner = untag_ptr(this_arg);
33545         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33547         this_arg_conv.is_owned = false;
33548         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
33549         uint64_t ret_ref = 0;
33550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33552         return ret_ref;
33553 }
33554
33555 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(uint64_t this_arg) {
33556         LDKChannelManager this_arg_conv;
33557         this_arg_conv.inner = untag_ptr(this_arg);
33558         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33560         this_arg_conv.is_owned = false;
33561         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
33562         uint64_t ret_ref = 0;
33563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33565         return ret_ref;
33566 }
33567
33568 uint64_t  __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(uint64_t this_arg) {
33569         LDKChannelManager this_arg_conv;
33570         this_arg_conv.inner = untag_ptr(this_arg);
33571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33573         this_arg_conv.is_owned = false;
33574         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
33575         uint64_t ret_ref = 0;
33576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33578         return ret_ref;
33579 }
33580
33581 uint64_t  __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(uint64_t this_arg) {
33582         LDKChannelManager this_arg_conv;
33583         this_arg_conv.inner = untag_ptr(this_arg);
33584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33586         this_arg_conv.is_owned = false;
33587         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
33588         uint64_t ret_ref = 0;
33589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33591         return ret_ref;
33592 }
33593
33594 uint64_t  __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) {
33595         LDKChannelManager this_arg_conv;
33596         this_arg_conv.inner = untag_ptr(this_arg);
33597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
33598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
33599         this_arg_conv.is_owned = false;
33600         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
33601         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
33602         return tag_ptr(ret_ret, true);
33603 }
33604
33605 uint64_t  __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t config) {
33606         LDKUserConfig config_conv;
33607         config_conv.inner = untag_ptr(config);
33608         config_conv.is_owned = ptr_is_owned(config);
33609         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
33610         config_conv.is_owned = false;
33611         LDKInitFeatures ret_var = provided_init_features(&config_conv);
33612         uint64_t ret_ref = 0;
33613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33615         return ret_ref;
33616 }
33617
33618 int8_tArray  __attribute__((export_name("TS_CounterpartyForwardingInfo_write"))) TS_CounterpartyForwardingInfo_write(uint64_t obj) {
33619         LDKCounterpartyForwardingInfo obj_conv;
33620         obj_conv.inner = untag_ptr(obj);
33621         obj_conv.is_owned = ptr_is_owned(obj);
33622         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33623         obj_conv.is_owned = false;
33624         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
33625         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33626         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33627         CVec_u8Z_free(ret_var);
33628         return ret_arr;
33629 }
33630
33631 uint64_t  __attribute__((export_name("TS_CounterpartyForwardingInfo_read"))) TS_CounterpartyForwardingInfo_read(int8_tArray ser) {
33632         LDKu8slice ser_ref;
33633         ser_ref.datalen = ser->arr_len;
33634         ser_ref.data = ser->elems;
33635         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
33636         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
33637         FREE(ser);
33638         return tag_ptr(ret_conv, true);
33639 }
33640
33641 int8_tArray  __attribute__((export_name("TS_ChannelCounterparty_write"))) TS_ChannelCounterparty_write(uint64_t obj) {
33642         LDKChannelCounterparty obj_conv;
33643         obj_conv.inner = untag_ptr(obj);
33644         obj_conv.is_owned = ptr_is_owned(obj);
33645         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33646         obj_conv.is_owned = false;
33647         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
33648         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33649         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33650         CVec_u8Z_free(ret_var);
33651         return ret_arr;
33652 }
33653
33654 uint64_t  __attribute__((export_name("TS_ChannelCounterparty_read"))) TS_ChannelCounterparty_read(int8_tArray ser) {
33655         LDKu8slice ser_ref;
33656         ser_ref.datalen = ser->arr_len;
33657         ser_ref.data = ser->elems;
33658         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
33659         *ret_conv = ChannelCounterparty_read(ser_ref);
33660         FREE(ser);
33661         return tag_ptr(ret_conv, true);
33662 }
33663
33664 int8_tArray  __attribute__((export_name("TS_ChannelDetails_write"))) TS_ChannelDetails_write(uint64_t obj) {
33665         LDKChannelDetails obj_conv;
33666         obj_conv.inner = untag_ptr(obj);
33667         obj_conv.is_owned = ptr_is_owned(obj);
33668         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33669         obj_conv.is_owned = false;
33670         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
33671         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33672         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33673         CVec_u8Z_free(ret_var);
33674         return ret_arr;
33675 }
33676
33677 uint64_t  __attribute__((export_name("TS_ChannelDetails_read"))) TS_ChannelDetails_read(int8_tArray ser) {
33678         LDKu8slice ser_ref;
33679         ser_ref.datalen = ser->arr_len;
33680         ser_ref.data = ser->elems;
33681         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
33682         *ret_conv = ChannelDetails_read(ser_ref);
33683         FREE(ser);
33684         return tag_ptr(ret_conv, true);
33685 }
33686
33687 int8_tArray  __attribute__((export_name("TS_PhantomRouteHints_write"))) TS_PhantomRouteHints_write(uint64_t obj) {
33688         LDKPhantomRouteHints obj_conv;
33689         obj_conv.inner = untag_ptr(obj);
33690         obj_conv.is_owned = ptr_is_owned(obj);
33691         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33692         obj_conv.is_owned = false;
33693         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
33694         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33695         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33696         CVec_u8Z_free(ret_var);
33697         return ret_arr;
33698 }
33699
33700 uint64_t  __attribute__((export_name("TS_PhantomRouteHints_read"))) TS_PhantomRouteHints_read(int8_tArray ser) {
33701         LDKu8slice ser_ref;
33702         ser_ref.datalen = ser->arr_len;
33703         ser_ref.data = ser->elems;
33704         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
33705         *ret_conv = PhantomRouteHints_read(ser_ref);
33706         FREE(ser);
33707         return tag_ptr(ret_conv, true);
33708 }
33709
33710 int8_tArray  __attribute__((export_name("TS_ChannelManager_write"))) TS_ChannelManager_write(uint64_t obj) {
33711         LDKChannelManager obj_conv;
33712         obj_conv.inner = untag_ptr(obj);
33713         obj_conv.is_owned = ptr_is_owned(obj);
33714         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
33715         obj_conv.is_owned = false;
33716         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
33717         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33718         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33719         CVec_u8Z_free(ret_var);
33720         return ret_arr;
33721 }
33722
33723 int8_tArray  __attribute__((export_name("TS_ChannelShutdownState_write"))) TS_ChannelShutdownState_write(uint64_t obj) {
33724         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
33725         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
33726         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
33727         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
33728         CVec_u8Z_free(ret_var);
33729         return ret_arr;
33730 }
33731
33732 uint64_t  __attribute__((export_name("TS_ChannelShutdownState_read"))) TS_ChannelShutdownState_read(int8_tArray ser) {
33733         LDKu8slice ser_ref;
33734         ser_ref.datalen = ser->arr_len;
33735         ser_ref.data = ser->elems;
33736         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
33737         *ret_conv = ChannelShutdownState_read(ser_ref);
33738         FREE(ser);
33739         return tag_ptr(ret_conv, true);
33740 }
33741
33742 void  __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelManagerReadArgs_free(uint64_t this_obj) {
33743         LDKChannelManagerReadArgs this_obj_conv;
33744         this_obj_conv.inner = untag_ptr(this_obj);
33745         this_obj_conv.is_owned = ptr_is_owned(this_obj);
33746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
33747         ChannelManagerReadArgs_free(this_obj_conv);
33748 }
33749
33750 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) {
33751         LDKChannelManagerReadArgs this_ptr_conv;
33752         this_ptr_conv.inner = untag_ptr(this_ptr);
33753         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33754         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33755         this_ptr_conv.is_owned = false;
33756         // WARNING: This object doesn't live past this scope, needs clone!
33757         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
33758         return ret_ret;
33759 }
33760
33761 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) {
33762         LDKChannelManagerReadArgs this_ptr_conv;
33763         this_ptr_conv.inner = untag_ptr(this_ptr);
33764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33766         this_ptr_conv.is_owned = false;
33767         void* val_ptr = untag_ptr(val);
33768         CHECK_ACCESS(val_ptr);
33769         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
33770         if (val_conv.free == LDKEntropySource_JCalls_free) {
33771                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33772                 LDKEntropySource_JCalls_cloned(&val_conv);
33773         }
33774         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
33775 }
33776
33777 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) {
33778         LDKChannelManagerReadArgs this_ptr_conv;
33779         this_ptr_conv.inner = untag_ptr(this_ptr);
33780         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33782         this_ptr_conv.is_owned = false;
33783         // WARNING: This object doesn't live past this scope, needs clone!
33784         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
33785         return ret_ret;
33786 }
33787
33788 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) {
33789         LDKChannelManagerReadArgs this_ptr_conv;
33790         this_ptr_conv.inner = untag_ptr(this_ptr);
33791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33793         this_ptr_conv.is_owned = false;
33794         void* val_ptr = untag_ptr(val);
33795         CHECK_ACCESS(val_ptr);
33796         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
33797         if (val_conv.free == LDKNodeSigner_JCalls_free) {
33798                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33799                 LDKNodeSigner_JCalls_cloned(&val_conv);
33800         }
33801         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
33802 }
33803
33804 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) {
33805         LDKChannelManagerReadArgs this_ptr_conv;
33806         this_ptr_conv.inner = untag_ptr(this_ptr);
33807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33809         this_ptr_conv.is_owned = false;
33810         // WARNING: This object doesn't live past this scope, needs clone!
33811         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
33812         return ret_ret;
33813 }
33814
33815 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) {
33816         LDKChannelManagerReadArgs this_ptr_conv;
33817         this_ptr_conv.inner = untag_ptr(this_ptr);
33818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33820         this_ptr_conv.is_owned = false;
33821         void* val_ptr = untag_ptr(val);
33822         CHECK_ACCESS(val_ptr);
33823         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
33824         if (val_conv.free == LDKSignerProvider_JCalls_free) {
33825                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33826                 LDKSignerProvider_JCalls_cloned(&val_conv);
33827         }
33828         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
33829 }
33830
33831 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) {
33832         LDKChannelManagerReadArgs 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         // WARNING: This object doesn't live past this scope, needs clone!
33838         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
33839         return ret_ret;
33840 }
33841
33842 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_fee_estimator"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint64_t this_ptr, uint64_t val) {
33843         LDKChannelManagerReadArgs this_ptr_conv;
33844         this_ptr_conv.inner = untag_ptr(this_ptr);
33845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33847         this_ptr_conv.is_owned = false;
33848         void* val_ptr = untag_ptr(val);
33849         CHECK_ACCESS(val_ptr);
33850         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
33851         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
33852                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33853                 LDKFeeEstimator_JCalls_cloned(&val_conv);
33854         }
33855         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
33856 }
33857
33858 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_chain_monitor"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint64_t this_ptr) {
33859         LDKChannelManagerReadArgs this_ptr_conv;
33860         this_ptr_conv.inner = untag_ptr(this_ptr);
33861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33863         this_ptr_conv.is_owned = false;
33864         // WARNING: This object doesn't live past this scope, needs clone!
33865         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
33866         return ret_ret;
33867 }
33868
33869 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_chain_monitor"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint64_t this_ptr, uint64_t val) {
33870         LDKChannelManagerReadArgs this_ptr_conv;
33871         this_ptr_conv.inner = untag_ptr(this_ptr);
33872         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33874         this_ptr_conv.is_owned = false;
33875         void* val_ptr = untag_ptr(val);
33876         CHECK_ACCESS(val_ptr);
33877         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
33878         if (val_conv.free == LDKWatch_JCalls_free) {
33879                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33880                 LDKWatch_JCalls_cloned(&val_conv);
33881         }
33882         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
33883 }
33884
33885 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_tx_broadcaster"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint64_t this_ptr) {
33886         LDKChannelManagerReadArgs this_ptr_conv;
33887         this_ptr_conv.inner = untag_ptr(this_ptr);
33888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33890         this_ptr_conv.is_owned = false;
33891         // WARNING: This object doesn't live past this scope, needs clone!
33892         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
33893         return ret_ret;
33894 }
33895
33896 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint64_t this_ptr, uint64_t val) {
33897         LDKChannelManagerReadArgs this_ptr_conv;
33898         this_ptr_conv.inner = untag_ptr(this_ptr);
33899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33901         this_ptr_conv.is_owned = false;
33902         void* val_ptr = untag_ptr(val);
33903         CHECK_ACCESS(val_ptr);
33904         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
33905         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
33906                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33907                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
33908         }
33909         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
33910 }
33911
33912 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) {
33913         LDKChannelManagerReadArgs this_ptr_conv;
33914         this_ptr_conv.inner = untag_ptr(this_ptr);
33915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33917         this_ptr_conv.is_owned = false;
33918         // WARNING: This object doesn't live past this scope, needs clone!
33919         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
33920         return ret_ret;
33921 }
33922
33923 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) {
33924         LDKChannelManagerReadArgs this_ptr_conv;
33925         this_ptr_conv.inner = untag_ptr(this_ptr);
33926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33928         this_ptr_conv.is_owned = false;
33929         void* val_ptr = untag_ptr(val);
33930         CHECK_ACCESS(val_ptr);
33931         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
33932         if (val_conv.free == LDKRouter_JCalls_free) {
33933                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33934                 LDKRouter_JCalls_cloned(&val_conv);
33935         }
33936         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
33937 }
33938
33939 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) {
33940         LDKChannelManagerReadArgs this_ptr_conv;
33941         this_ptr_conv.inner = untag_ptr(this_ptr);
33942         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33943         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33944         this_ptr_conv.is_owned = false;
33945         // WARNING: This object doesn't live past this scope, needs clone!
33946         uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
33947         return ret_ret;
33948 }
33949
33950 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_logger"))) TS_ChannelManagerReadArgs_set_logger(uint64_t this_ptr, uint64_t val) {
33951         LDKChannelManagerReadArgs this_ptr_conv;
33952         this_ptr_conv.inner = untag_ptr(this_ptr);
33953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33955         this_ptr_conv.is_owned = false;
33956         void* val_ptr = untag_ptr(val);
33957         CHECK_ACCESS(val_ptr);
33958         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
33959         if (val_conv.free == LDKLogger_JCalls_free) {
33960                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33961                 LDKLogger_JCalls_cloned(&val_conv);
33962         }
33963         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
33964 }
33965
33966 uint64_t  __attribute__((export_name("TS_ChannelManagerReadArgs_get_default_config"))) TS_ChannelManagerReadArgs_get_default_config(uint64_t this_ptr) {
33967         LDKChannelManagerReadArgs this_ptr_conv;
33968         this_ptr_conv.inner = untag_ptr(this_ptr);
33969         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33970         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33971         this_ptr_conv.is_owned = false;
33972         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
33973         uint64_t ret_ref = 0;
33974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
33975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
33976         return ret_ref;
33977 }
33978
33979 void  __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config"))) TS_ChannelManagerReadArgs_set_default_config(uint64_t this_ptr, uint64_t val) {
33980         LDKChannelManagerReadArgs this_ptr_conv;
33981         this_ptr_conv.inner = untag_ptr(this_ptr);
33982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
33983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
33984         this_ptr_conv.is_owned = false;
33985         LDKUserConfig val_conv;
33986         val_conv.inner = untag_ptr(val);
33987         val_conv.is_owned = ptr_is_owned(val);
33988         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
33989         val_conv = UserConfig_clone(&val_conv);
33990         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
33991 }
33992
33993 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) {
33994         void* entropy_source_ptr = untag_ptr(entropy_source);
33995         CHECK_ACCESS(entropy_source_ptr);
33996         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
33997         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
33998                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
33999                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
34000         }
34001         void* node_signer_ptr = untag_ptr(node_signer);
34002         CHECK_ACCESS(node_signer_ptr);
34003         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
34004         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
34005                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34006                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
34007         }
34008         void* signer_provider_ptr = untag_ptr(signer_provider);
34009         CHECK_ACCESS(signer_provider_ptr);
34010         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
34011         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
34012                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34013                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
34014         }
34015         void* fee_estimator_ptr = untag_ptr(fee_estimator);
34016         CHECK_ACCESS(fee_estimator_ptr);
34017         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
34018         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
34019                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34020                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
34021         }
34022         void* chain_monitor_ptr = untag_ptr(chain_monitor);
34023         CHECK_ACCESS(chain_monitor_ptr);
34024         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
34025         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
34026                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34027                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
34028         }
34029         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
34030         CHECK_ACCESS(tx_broadcaster_ptr);
34031         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
34032         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
34033                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34034                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
34035         }
34036         void* router_ptr = untag_ptr(router);
34037         CHECK_ACCESS(router_ptr);
34038         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
34039         if (router_conv.free == LDKRouter_JCalls_free) {
34040                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34041                 LDKRouter_JCalls_cloned(&router_conv);
34042         }
34043         void* logger_ptr = untag_ptr(logger);
34044         CHECK_ACCESS(logger_ptr);
34045         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
34046         if (logger_conv.free == LDKLogger_JCalls_free) {
34047                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
34048                 LDKLogger_JCalls_cloned(&logger_conv);
34049         }
34050         LDKUserConfig default_config_conv;
34051         default_config_conv.inner = untag_ptr(default_config);
34052         default_config_conv.is_owned = ptr_is_owned(default_config);
34053         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
34054         default_config_conv = UserConfig_clone(&default_config_conv);
34055         LDKCVec_ChannelMonitorZ channel_monitors_constr;
34056         channel_monitors_constr.datalen = channel_monitors->arr_len;
34057         if (channel_monitors_constr.datalen > 0)
34058                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
34059         else
34060                 channel_monitors_constr.data = NULL;
34061         uint64_t* channel_monitors_vals = channel_monitors->elems;
34062         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
34063                 uint64_t channel_monitors_conv_16 = channel_monitors_vals[q];
34064                 LDKChannelMonitor channel_monitors_conv_16_conv;
34065                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
34066                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
34067                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
34068                 channel_monitors_conv_16_conv.is_owned = false;
34069                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
34070         }
34071         FREE(channel_monitors);
34072         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);
34073         uint64_t ret_ref = 0;
34074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34076         return ret_ref;
34077 }
34078
34079 uint64_t  __attribute__((export_name("TS_C2Tuple_BlockHashChannelManagerZ_read"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint64_t arg) {
34080         LDKu8slice ser_ref;
34081         ser_ref.datalen = ser->arr_len;
34082         ser_ref.data = ser->elems;
34083         LDKChannelManagerReadArgs arg_conv;
34084         arg_conv.inner = untag_ptr(arg);
34085         arg_conv.is_owned = ptr_is_owned(arg);
34086         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34087         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
34088         
34089         LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
34090         *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
34091         FREE(ser);
34092         return tag_ptr(ret_conv, true);
34093 }
34094
34095 void  __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(uint64_t this_obj) {
34096         LDKExpandedKey this_obj_conv;
34097         this_obj_conv.inner = untag_ptr(this_obj);
34098         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34100         ExpandedKey_free(this_obj_conv);
34101 }
34102
34103 uint64_t  __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) {
34104         uint8_t key_material_arr[32];
34105         CHECK(key_material->arr_len == 32);
34106         memcpy(key_material_arr, key_material->elems, 32); FREE(key_material);
34107         uint8_t (*key_material_ref)[32] = &key_material_arr;
34108         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
34109         uint64_t ret_ref = 0;
34110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34112         return ret_ref;
34113 }
34114
34115 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) {
34116         LDKExpandedKey keys_conv;
34117         keys_conv.inner = untag_ptr(keys);
34118         keys_conv.is_owned = ptr_is_owned(keys);
34119         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34120         keys_conv.is_owned = false;
34121         void* min_value_msat_ptr = untag_ptr(min_value_msat);
34122         CHECK_ACCESS(min_value_msat_ptr);
34123         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
34124         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
34125         void* entropy_source_ptr = untag_ptr(entropy_source);
34126         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
34127         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
34128         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
34129         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
34130         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
34131         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
34132         LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ");
34133         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
34134         return tag_ptr(ret_conv, true);
34135 }
34136
34137 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) {
34138         LDKExpandedKey keys_conv;
34139         keys_conv.inner = untag_ptr(keys);
34140         keys_conv.is_owned = ptr_is_owned(keys);
34141         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
34142         keys_conv.is_owned = false;
34143         void* min_value_msat_ptr = untag_ptr(min_value_msat);
34144         CHECK_ACCESS(min_value_msat_ptr);
34145         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
34146         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
34147         LDKThirtyTwoBytes payment_hash_ref;
34148         CHECK(payment_hash->arr_len == 32);
34149         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
34150         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
34151         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
34152         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
34153         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
34154         LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ");
34155         *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);
34156         return tag_ptr(ret_conv, true);
34157 }
34158
34159 void  __attribute__((export_name("TS_DecodeError_free"))) TS_DecodeError_free(uint64_t this_ptr) {
34160         if (!ptr_is_owned(this_ptr)) return;
34161         void* this_ptr_ptr = untag_ptr(this_ptr);
34162         CHECK_ACCESS(this_ptr_ptr);
34163         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
34164         FREE(untag_ptr(this_ptr));
34165         DecodeError_free(this_ptr_conv);
34166 }
34167
34168 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
34169         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34170         *ret_copy = DecodeError_clone(arg);
34171         uint64_t ret_ref = tag_ptr(ret_copy, true);
34172         return ret_ref;
34173 }
34174 int64_t  __attribute__((export_name("TS_DecodeError_clone_ptr"))) TS_DecodeError_clone_ptr(uint64_t arg) {
34175         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
34176         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
34177         return ret_conv;
34178 }
34179
34180 uint64_t  __attribute__((export_name("TS_DecodeError_clone"))) TS_DecodeError_clone(uint64_t orig) {
34181         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
34182         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34183         *ret_copy = DecodeError_clone(orig_conv);
34184         uint64_t ret_ref = tag_ptr(ret_copy, true);
34185         return ret_ref;
34186 }
34187
34188 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_version"))) TS_DecodeError_unknown_version() {
34189         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34190         *ret_copy = DecodeError_unknown_version();
34191         uint64_t ret_ref = tag_ptr(ret_copy, true);
34192         return ret_ref;
34193 }
34194
34195 uint64_t  __attribute__((export_name("TS_DecodeError_unknown_required_feature"))) TS_DecodeError_unknown_required_feature() {
34196         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34197         *ret_copy = DecodeError_unknown_required_feature();
34198         uint64_t ret_ref = tag_ptr(ret_copy, true);
34199         return ret_ref;
34200 }
34201
34202 uint64_t  __attribute__((export_name("TS_DecodeError_invalid_value"))) TS_DecodeError_invalid_value() {
34203         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34204         *ret_copy = DecodeError_invalid_value();
34205         uint64_t ret_ref = tag_ptr(ret_copy, true);
34206         return ret_ref;
34207 }
34208
34209 uint64_t  __attribute__((export_name("TS_DecodeError_short_read"))) TS_DecodeError_short_read() {
34210         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34211         *ret_copy = DecodeError_short_read();
34212         uint64_t ret_ref = tag_ptr(ret_copy, true);
34213         return ret_ref;
34214 }
34215
34216 uint64_t  __attribute__((export_name("TS_DecodeError_bad_length_descriptor"))) TS_DecodeError_bad_length_descriptor() {
34217         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34218         *ret_copy = DecodeError_bad_length_descriptor();
34219         uint64_t ret_ref = tag_ptr(ret_copy, true);
34220         return ret_ref;
34221 }
34222
34223 uint64_t  __attribute__((export_name("TS_DecodeError_io"))) TS_DecodeError_io(uint32_t a) {
34224         LDKIOError a_conv = LDKIOError_from_js(a);
34225         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34226         *ret_copy = DecodeError_io(a_conv);
34227         uint64_t ret_ref = tag_ptr(ret_copy, true);
34228         return ret_ref;
34229 }
34230
34231 uint64_t  __attribute__((export_name("TS_DecodeError_unsupported_compression"))) TS_DecodeError_unsupported_compression() {
34232         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
34233         *ret_copy = DecodeError_unsupported_compression();
34234         uint64_t ret_ref = tag_ptr(ret_copy, true);
34235         return ret_ref;
34236 }
34237
34238 jboolean  __attribute__((export_name("TS_DecodeError_eq"))) TS_DecodeError_eq(uint64_t a, uint64_t b) {
34239         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
34240         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
34241         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
34242         return ret_conv;
34243 }
34244
34245 void  __attribute__((export_name("TS_Init_free"))) TS_Init_free(uint64_t this_obj) {
34246         LDKInit this_obj_conv;
34247         this_obj_conv.inner = untag_ptr(this_obj);
34248         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34250         Init_free(this_obj_conv);
34251 }
34252
34253 uint64_t  __attribute__((export_name("TS_Init_get_features"))) TS_Init_get_features(uint64_t this_ptr) {
34254         LDKInit this_ptr_conv;
34255         this_ptr_conv.inner = untag_ptr(this_ptr);
34256         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34258         this_ptr_conv.is_owned = false;
34259         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
34260         uint64_t ret_ref = 0;
34261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34263         return ret_ref;
34264 }
34265
34266 void  __attribute__((export_name("TS_Init_set_features"))) TS_Init_set_features(uint64_t this_ptr, uint64_t val) {
34267         LDKInit this_ptr_conv;
34268         this_ptr_conv.inner = untag_ptr(this_ptr);
34269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34271         this_ptr_conv.is_owned = false;
34272         LDKInitFeatures val_conv;
34273         val_conv.inner = untag_ptr(val);
34274         val_conv.is_owned = ptr_is_owned(val);
34275         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
34276         val_conv = InitFeatures_clone(&val_conv);
34277         Init_set_features(&this_ptr_conv, val_conv);
34278 }
34279
34280 uint64_t  __attribute__((export_name("TS_Init_get_networks"))) TS_Init_get_networks(uint64_t this_ptr) {
34281         LDKInit this_ptr_conv;
34282         this_ptr_conv.inner = untag_ptr(this_ptr);
34283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34285         this_ptr_conv.is_owned = false;
34286         LDKCOption_CVec_ChainHashZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ChainHashZZ), "LDKCOption_CVec_ChainHashZZ");
34287         *ret_copy = Init_get_networks(&this_ptr_conv);
34288         uint64_t ret_ref = tag_ptr(ret_copy, true);
34289         return ret_ref;
34290 }
34291
34292 void  __attribute__((export_name("TS_Init_set_networks"))) TS_Init_set_networks(uint64_t this_ptr, uint64_t val) {
34293         LDKInit this_ptr_conv;
34294         this_ptr_conv.inner = untag_ptr(this_ptr);
34295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34297         this_ptr_conv.is_owned = false;
34298         void* val_ptr = untag_ptr(val);
34299         CHECK_ACCESS(val_ptr);
34300         LDKCOption_CVec_ChainHashZZ val_conv = *(LDKCOption_CVec_ChainHashZZ*)(val_ptr);
34301         val_conv = COption_CVec_ChainHashZZ_clone((LDKCOption_CVec_ChainHashZZ*)untag_ptr(val));
34302         Init_set_networks(&this_ptr_conv, val_conv);
34303 }
34304
34305 uint64_t  __attribute__((export_name("TS_Init_get_remote_network_address"))) TS_Init_get_remote_network_address(uint64_t this_ptr) {
34306         LDKInit this_ptr_conv;
34307         this_ptr_conv.inner = untag_ptr(this_ptr);
34308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34310         this_ptr_conv.is_owned = false;
34311         LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ");
34312         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
34313         uint64_t ret_ref = tag_ptr(ret_copy, true);
34314         return ret_ref;
34315 }
34316
34317 void  __attribute__((export_name("TS_Init_set_remote_network_address"))) TS_Init_set_remote_network_address(uint64_t this_ptr, uint64_t val) {
34318         LDKInit this_ptr_conv;
34319         this_ptr_conv.inner = untag_ptr(this_ptr);
34320         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34322         this_ptr_conv.is_owned = false;
34323         void* val_ptr = untag_ptr(val);
34324         CHECK_ACCESS(val_ptr);
34325         LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr);
34326         val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(val));
34327         Init_set_remote_network_address(&this_ptr_conv, val_conv);
34328 }
34329
34330 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) {
34331         LDKInitFeatures features_arg_conv;
34332         features_arg_conv.inner = untag_ptr(features_arg);
34333         features_arg_conv.is_owned = ptr_is_owned(features_arg);
34334         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
34335         features_arg_conv = InitFeatures_clone(&features_arg_conv);
34336         void* networks_arg_ptr = untag_ptr(networks_arg);
34337         CHECK_ACCESS(networks_arg_ptr);
34338         LDKCOption_CVec_ChainHashZZ networks_arg_conv = *(LDKCOption_CVec_ChainHashZZ*)(networks_arg_ptr);
34339         networks_arg_conv = COption_CVec_ChainHashZZ_clone((LDKCOption_CVec_ChainHashZZ*)untag_ptr(networks_arg));
34340         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
34341         CHECK_ACCESS(remote_network_address_arg_ptr);
34342         LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr);
34343         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
34344         uint64_t ret_ref = 0;
34345         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34346         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34347         return ret_ref;
34348 }
34349
34350 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
34351         LDKInit ret_var = Init_clone(arg);
34352         uint64_t ret_ref = 0;
34353         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34354         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34355         return ret_ref;
34356 }
34357 int64_t  __attribute__((export_name("TS_Init_clone_ptr"))) TS_Init_clone_ptr(uint64_t arg) {
34358         LDKInit arg_conv;
34359         arg_conv.inner = untag_ptr(arg);
34360         arg_conv.is_owned = ptr_is_owned(arg);
34361         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34362         arg_conv.is_owned = false;
34363         int64_t ret_conv = Init_clone_ptr(&arg_conv);
34364         return ret_conv;
34365 }
34366
34367 uint64_t  __attribute__((export_name("TS_Init_clone"))) TS_Init_clone(uint64_t orig) {
34368         LDKInit orig_conv;
34369         orig_conv.inner = untag_ptr(orig);
34370         orig_conv.is_owned = ptr_is_owned(orig);
34371         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34372         orig_conv.is_owned = false;
34373         LDKInit ret_var = Init_clone(&orig_conv);
34374         uint64_t ret_ref = 0;
34375         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34376         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34377         return ret_ref;
34378 }
34379
34380 jboolean  __attribute__((export_name("TS_Init_eq"))) TS_Init_eq(uint64_t a, uint64_t b) {
34381         LDKInit a_conv;
34382         a_conv.inner = untag_ptr(a);
34383         a_conv.is_owned = ptr_is_owned(a);
34384         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34385         a_conv.is_owned = false;
34386         LDKInit b_conv;
34387         b_conv.inner = untag_ptr(b);
34388         b_conv.is_owned = ptr_is_owned(b);
34389         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34390         b_conv.is_owned = false;
34391         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
34392         return ret_conv;
34393 }
34394
34395 void  __attribute__((export_name("TS_ErrorMessage_free"))) TS_ErrorMessage_free(uint64_t this_obj) {
34396         LDKErrorMessage this_obj_conv;
34397         this_obj_conv.inner = untag_ptr(this_obj);
34398         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34399         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34400         ErrorMessage_free(this_obj_conv);
34401 }
34402
34403 int8_tArray  __attribute__((export_name("TS_ErrorMessage_get_channel_id"))) TS_ErrorMessage_get_channel_id(uint64_t this_ptr) {
34404         LDKErrorMessage this_ptr_conv;
34405         this_ptr_conv.inner = untag_ptr(this_ptr);
34406         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34407         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34408         this_ptr_conv.is_owned = false;
34409         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34410         memcpy(ret_arr->elems, *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
34411         return ret_arr;
34412 }
34413
34414 void  __attribute__((export_name("TS_ErrorMessage_set_channel_id"))) TS_ErrorMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
34415         LDKErrorMessage this_ptr_conv;
34416         this_ptr_conv.inner = untag_ptr(this_ptr);
34417         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34419         this_ptr_conv.is_owned = false;
34420         LDKThirtyTwoBytes val_ref;
34421         CHECK(val->arr_len == 32);
34422         memcpy(val_ref.data, val->elems, 32); FREE(val);
34423         ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
34424 }
34425
34426 jstring  __attribute__((export_name("TS_ErrorMessage_get_data"))) TS_ErrorMessage_get_data(uint64_t this_ptr) {
34427         LDKErrorMessage this_ptr_conv;
34428         this_ptr_conv.inner = untag_ptr(this_ptr);
34429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34431         this_ptr_conv.is_owned = false;
34432         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
34433         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
34434         Str_free(ret_str);
34435         return ret_conv;
34436 }
34437
34438 void  __attribute__((export_name("TS_ErrorMessage_set_data"))) TS_ErrorMessage_set_data(uint64_t this_ptr, jstring val) {
34439         LDKErrorMessage this_ptr_conv;
34440         this_ptr_conv.inner = untag_ptr(this_ptr);
34441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34443         this_ptr_conv.is_owned = false;
34444         LDKStr val_conv = str_ref_to_owned_c(val);
34445         ErrorMessage_set_data(&this_ptr_conv, val_conv);
34446 }
34447
34448 uint64_t  __attribute__((export_name("TS_ErrorMessage_new"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
34449         LDKThirtyTwoBytes channel_id_arg_ref;
34450         CHECK(channel_id_arg->arr_len == 32);
34451         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
34452         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
34453         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
34454         uint64_t ret_ref = 0;
34455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34457         return ret_ref;
34458 }
34459
34460 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
34461         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
34462         uint64_t ret_ref = 0;
34463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34465         return ret_ref;
34466 }
34467 int64_t  __attribute__((export_name("TS_ErrorMessage_clone_ptr"))) TS_ErrorMessage_clone_ptr(uint64_t arg) {
34468         LDKErrorMessage arg_conv;
34469         arg_conv.inner = untag_ptr(arg);
34470         arg_conv.is_owned = ptr_is_owned(arg);
34471         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34472         arg_conv.is_owned = false;
34473         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
34474         return ret_conv;
34475 }
34476
34477 uint64_t  __attribute__((export_name("TS_ErrorMessage_clone"))) TS_ErrorMessage_clone(uint64_t orig) {
34478         LDKErrorMessage orig_conv;
34479         orig_conv.inner = untag_ptr(orig);
34480         orig_conv.is_owned = ptr_is_owned(orig);
34481         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34482         orig_conv.is_owned = false;
34483         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
34484         uint64_t ret_ref = 0;
34485         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34486         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34487         return ret_ref;
34488 }
34489
34490 jboolean  __attribute__((export_name("TS_ErrorMessage_eq"))) TS_ErrorMessage_eq(uint64_t a, uint64_t b) {
34491         LDKErrorMessage a_conv;
34492         a_conv.inner = untag_ptr(a);
34493         a_conv.is_owned = ptr_is_owned(a);
34494         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34495         a_conv.is_owned = false;
34496         LDKErrorMessage b_conv;
34497         b_conv.inner = untag_ptr(b);
34498         b_conv.is_owned = ptr_is_owned(b);
34499         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34500         b_conv.is_owned = false;
34501         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
34502         return ret_conv;
34503 }
34504
34505 void  __attribute__((export_name("TS_WarningMessage_free"))) TS_WarningMessage_free(uint64_t this_obj) {
34506         LDKWarningMessage this_obj_conv;
34507         this_obj_conv.inner = untag_ptr(this_obj);
34508         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34510         WarningMessage_free(this_obj_conv);
34511 }
34512
34513 int8_tArray  __attribute__((export_name("TS_WarningMessage_get_channel_id"))) TS_WarningMessage_get_channel_id(uint64_t this_ptr) {
34514         LDKWarningMessage this_ptr_conv;
34515         this_ptr_conv.inner = untag_ptr(this_ptr);
34516         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34517         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34518         this_ptr_conv.is_owned = false;
34519         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34520         memcpy(ret_arr->elems, *WarningMessage_get_channel_id(&this_ptr_conv), 32);
34521         return ret_arr;
34522 }
34523
34524 void  __attribute__((export_name("TS_WarningMessage_set_channel_id"))) TS_WarningMessage_set_channel_id(uint64_t this_ptr, int8_tArray val) {
34525         LDKWarningMessage this_ptr_conv;
34526         this_ptr_conv.inner = untag_ptr(this_ptr);
34527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34529         this_ptr_conv.is_owned = false;
34530         LDKThirtyTwoBytes val_ref;
34531         CHECK(val->arr_len == 32);
34532         memcpy(val_ref.data, val->elems, 32); FREE(val);
34533         WarningMessage_set_channel_id(&this_ptr_conv, val_ref);
34534 }
34535
34536 jstring  __attribute__((export_name("TS_WarningMessage_get_data"))) TS_WarningMessage_get_data(uint64_t this_ptr) {
34537         LDKWarningMessage this_ptr_conv;
34538         this_ptr_conv.inner = untag_ptr(this_ptr);
34539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34541         this_ptr_conv.is_owned = false;
34542         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
34543         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
34544         Str_free(ret_str);
34545         return ret_conv;
34546 }
34547
34548 void  __attribute__((export_name("TS_WarningMessage_set_data"))) TS_WarningMessage_set_data(uint64_t this_ptr, jstring val) {
34549         LDKWarningMessage this_ptr_conv;
34550         this_ptr_conv.inner = untag_ptr(this_ptr);
34551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34553         this_ptr_conv.is_owned = false;
34554         LDKStr val_conv = str_ref_to_owned_c(val);
34555         WarningMessage_set_data(&this_ptr_conv, val_conv);
34556 }
34557
34558 uint64_t  __attribute__((export_name("TS_WarningMessage_new"))) TS_WarningMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
34559         LDKThirtyTwoBytes channel_id_arg_ref;
34560         CHECK(channel_id_arg->arr_len == 32);
34561         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
34562         LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
34563         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_ref, data_arg_conv);
34564         uint64_t ret_ref = 0;
34565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34567         return ret_ref;
34568 }
34569
34570 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
34571         LDKWarningMessage ret_var = WarningMessage_clone(arg);
34572         uint64_t ret_ref = 0;
34573         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34574         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34575         return ret_ref;
34576 }
34577 int64_t  __attribute__((export_name("TS_WarningMessage_clone_ptr"))) TS_WarningMessage_clone_ptr(uint64_t arg) {
34578         LDKWarningMessage arg_conv;
34579         arg_conv.inner = untag_ptr(arg);
34580         arg_conv.is_owned = ptr_is_owned(arg);
34581         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34582         arg_conv.is_owned = false;
34583         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
34584         return ret_conv;
34585 }
34586
34587 uint64_t  __attribute__((export_name("TS_WarningMessage_clone"))) TS_WarningMessage_clone(uint64_t orig) {
34588         LDKWarningMessage orig_conv;
34589         orig_conv.inner = untag_ptr(orig);
34590         orig_conv.is_owned = ptr_is_owned(orig);
34591         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34592         orig_conv.is_owned = false;
34593         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
34594         uint64_t ret_ref = 0;
34595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34597         return ret_ref;
34598 }
34599
34600 jboolean  __attribute__((export_name("TS_WarningMessage_eq"))) TS_WarningMessage_eq(uint64_t a, uint64_t b) {
34601         LDKWarningMessage a_conv;
34602         a_conv.inner = untag_ptr(a);
34603         a_conv.is_owned = ptr_is_owned(a);
34604         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34605         a_conv.is_owned = false;
34606         LDKWarningMessage b_conv;
34607         b_conv.inner = untag_ptr(b);
34608         b_conv.is_owned = ptr_is_owned(b);
34609         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34610         b_conv.is_owned = false;
34611         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
34612         return ret_conv;
34613 }
34614
34615 void  __attribute__((export_name("TS_Ping_free"))) TS_Ping_free(uint64_t this_obj) {
34616         LDKPing this_obj_conv;
34617         this_obj_conv.inner = untag_ptr(this_obj);
34618         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34620         Ping_free(this_obj_conv);
34621 }
34622
34623 int16_t  __attribute__((export_name("TS_Ping_get_ponglen"))) TS_Ping_get_ponglen(uint64_t this_ptr) {
34624         LDKPing this_ptr_conv;
34625         this_ptr_conv.inner = untag_ptr(this_ptr);
34626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34628         this_ptr_conv.is_owned = false;
34629         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
34630         return ret_conv;
34631 }
34632
34633 void  __attribute__((export_name("TS_Ping_set_ponglen"))) TS_Ping_set_ponglen(uint64_t this_ptr, int16_t val) {
34634         LDKPing this_ptr_conv;
34635         this_ptr_conv.inner = untag_ptr(this_ptr);
34636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34638         this_ptr_conv.is_owned = false;
34639         Ping_set_ponglen(&this_ptr_conv, val);
34640 }
34641
34642 int16_t  __attribute__((export_name("TS_Ping_get_byteslen"))) TS_Ping_get_byteslen(uint64_t this_ptr) {
34643         LDKPing this_ptr_conv;
34644         this_ptr_conv.inner = untag_ptr(this_ptr);
34645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34647         this_ptr_conv.is_owned = false;
34648         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
34649         return ret_conv;
34650 }
34651
34652 void  __attribute__((export_name("TS_Ping_set_byteslen"))) TS_Ping_set_byteslen(uint64_t this_ptr, int16_t val) {
34653         LDKPing this_ptr_conv;
34654         this_ptr_conv.inner = untag_ptr(this_ptr);
34655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34657         this_ptr_conv.is_owned = false;
34658         Ping_set_byteslen(&this_ptr_conv, val);
34659 }
34660
34661 uint64_t  __attribute__((export_name("TS_Ping_new"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
34662         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
34663         uint64_t ret_ref = 0;
34664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34666         return ret_ref;
34667 }
34668
34669 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
34670         LDKPing ret_var = Ping_clone(arg);
34671         uint64_t ret_ref = 0;
34672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34674         return ret_ref;
34675 }
34676 int64_t  __attribute__((export_name("TS_Ping_clone_ptr"))) TS_Ping_clone_ptr(uint64_t arg) {
34677         LDKPing arg_conv;
34678         arg_conv.inner = untag_ptr(arg);
34679         arg_conv.is_owned = ptr_is_owned(arg);
34680         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34681         arg_conv.is_owned = false;
34682         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
34683         return ret_conv;
34684 }
34685
34686 uint64_t  __attribute__((export_name("TS_Ping_clone"))) TS_Ping_clone(uint64_t orig) {
34687         LDKPing orig_conv;
34688         orig_conv.inner = untag_ptr(orig);
34689         orig_conv.is_owned = ptr_is_owned(orig);
34690         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34691         orig_conv.is_owned = false;
34692         LDKPing ret_var = Ping_clone(&orig_conv);
34693         uint64_t ret_ref = 0;
34694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34696         return ret_ref;
34697 }
34698
34699 jboolean  __attribute__((export_name("TS_Ping_eq"))) TS_Ping_eq(uint64_t a, uint64_t b) {
34700         LDKPing a_conv;
34701         a_conv.inner = untag_ptr(a);
34702         a_conv.is_owned = ptr_is_owned(a);
34703         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34704         a_conv.is_owned = false;
34705         LDKPing b_conv;
34706         b_conv.inner = untag_ptr(b);
34707         b_conv.is_owned = ptr_is_owned(b);
34708         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34709         b_conv.is_owned = false;
34710         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
34711         return ret_conv;
34712 }
34713
34714 void  __attribute__((export_name("TS_Pong_free"))) TS_Pong_free(uint64_t this_obj) {
34715         LDKPong this_obj_conv;
34716         this_obj_conv.inner = untag_ptr(this_obj);
34717         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34719         Pong_free(this_obj_conv);
34720 }
34721
34722 int16_t  __attribute__((export_name("TS_Pong_get_byteslen"))) TS_Pong_get_byteslen(uint64_t this_ptr) {
34723         LDKPong this_ptr_conv;
34724         this_ptr_conv.inner = untag_ptr(this_ptr);
34725         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34726         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34727         this_ptr_conv.is_owned = false;
34728         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
34729         return ret_conv;
34730 }
34731
34732 void  __attribute__((export_name("TS_Pong_set_byteslen"))) TS_Pong_set_byteslen(uint64_t this_ptr, int16_t val) {
34733         LDKPong this_ptr_conv;
34734         this_ptr_conv.inner = untag_ptr(this_ptr);
34735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34737         this_ptr_conv.is_owned = false;
34738         Pong_set_byteslen(&this_ptr_conv, val);
34739 }
34740
34741 uint64_t  __attribute__((export_name("TS_Pong_new"))) TS_Pong_new(int16_t byteslen_arg) {
34742         LDKPong ret_var = Pong_new(byteslen_arg);
34743         uint64_t ret_ref = 0;
34744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34746         return ret_ref;
34747 }
34748
34749 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
34750         LDKPong ret_var = Pong_clone(arg);
34751         uint64_t ret_ref = 0;
34752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34754         return ret_ref;
34755 }
34756 int64_t  __attribute__((export_name("TS_Pong_clone_ptr"))) TS_Pong_clone_ptr(uint64_t arg) {
34757         LDKPong arg_conv;
34758         arg_conv.inner = untag_ptr(arg);
34759         arg_conv.is_owned = ptr_is_owned(arg);
34760         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
34761         arg_conv.is_owned = false;
34762         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
34763         return ret_conv;
34764 }
34765
34766 uint64_t  __attribute__((export_name("TS_Pong_clone"))) TS_Pong_clone(uint64_t orig) {
34767         LDKPong orig_conv;
34768         orig_conv.inner = untag_ptr(orig);
34769         orig_conv.is_owned = ptr_is_owned(orig);
34770         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
34771         orig_conv.is_owned = false;
34772         LDKPong ret_var = Pong_clone(&orig_conv);
34773         uint64_t ret_ref = 0;
34774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
34775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
34776         return ret_ref;
34777 }
34778
34779 jboolean  __attribute__((export_name("TS_Pong_eq"))) TS_Pong_eq(uint64_t a, uint64_t b) {
34780         LDKPong a_conv;
34781         a_conv.inner = untag_ptr(a);
34782         a_conv.is_owned = ptr_is_owned(a);
34783         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
34784         a_conv.is_owned = false;
34785         LDKPong b_conv;
34786         b_conv.inner = untag_ptr(b);
34787         b_conv.is_owned = ptr_is_owned(b);
34788         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
34789         b_conv.is_owned = false;
34790         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
34791         return ret_conv;
34792 }
34793
34794 void  __attribute__((export_name("TS_OpenChannel_free"))) TS_OpenChannel_free(uint64_t this_obj) {
34795         LDKOpenChannel this_obj_conv;
34796         this_obj_conv.inner = untag_ptr(this_obj);
34797         this_obj_conv.is_owned = ptr_is_owned(this_obj);
34798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
34799         OpenChannel_free(this_obj_conv);
34800 }
34801
34802 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_chain_hash"))) TS_OpenChannel_get_chain_hash(uint64_t this_ptr) {
34803         LDKOpenChannel this_ptr_conv;
34804         this_ptr_conv.inner = untag_ptr(this_ptr);
34805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34807         this_ptr_conv.is_owned = false;
34808         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34809         memcpy(ret_arr->elems, *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
34810         return ret_arr;
34811 }
34812
34813 void  __attribute__((export_name("TS_OpenChannel_set_chain_hash"))) TS_OpenChannel_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
34814         LDKOpenChannel this_ptr_conv;
34815         this_ptr_conv.inner = untag_ptr(this_ptr);
34816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34818         this_ptr_conv.is_owned = false;
34819         LDKThirtyTwoBytes val_ref;
34820         CHECK(val->arr_len == 32);
34821         memcpy(val_ref.data, val->elems, 32); FREE(val);
34822         OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
34823 }
34824
34825 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_temporary_channel_id"))) TS_OpenChannel_get_temporary_channel_id(uint64_t this_ptr) {
34826         LDKOpenChannel this_ptr_conv;
34827         this_ptr_conv.inner = untag_ptr(this_ptr);
34828         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34830         this_ptr_conv.is_owned = false;
34831         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
34832         memcpy(ret_arr->elems, *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
34833         return ret_arr;
34834 }
34835
34836 void  __attribute__((export_name("TS_OpenChannel_set_temporary_channel_id"))) TS_OpenChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
34837         LDKOpenChannel this_ptr_conv;
34838         this_ptr_conv.inner = untag_ptr(this_ptr);
34839         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34841         this_ptr_conv.is_owned = false;
34842         LDKThirtyTwoBytes val_ref;
34843         CHECK(val->arr_len == 32);
34844         memcpy(val_ref.data, val->elems, 32); FREE(val);
34845         OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
34846 }
34847
34848 int64_t  __attribute__((export_name("TS_OpenChannel_get_funding_satoshis"))) TS_OpenChannel_get_funding_satoshis(uint64_t this_ptr) {
34849         LDKOpenChannel this_ptr_conv;
34850         this_ptr_conv.inner = untag_ptr(this_ptr);
34851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34853         this_ptr_conv.is_owned = false;
34854         int64_t ret_conv = OpenChannel_get_funding_satoshis(&this_ptr_conv);
34855         return ret_conv;
34856 }
34857
34858 void  __attribute__((export_name("TS_OpenChannel_set_funding_satoshis"))) TS_OpenChannel_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
34859         LDKOpenChannel this_ptr_conv;
34860         this_ptr_conv.inner = untag_ptr(this_ptr);
34861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34863         this_ptr_conv.is_owned = false;
34864         OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
34865 }
34866
34867 int64_t  __attribute__((export_name("TS_OpenChannel_get_push_msat"))) TS_OpenChannel_get_push_msat(uint64_t this_ptr) {
34868         LDKOpenChannel this_ptr_conv;
34869         this_ptr_conv.inner = untag_ptr(this_ptr);
34870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34872         this_ptr_conv.is_owned = false;
34873         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
34874         return ret_conv;
34875 }
34876
34877 void  __attribute__((export_name("TS_OpenChannel_set_push_msat"))) TS_OpenChannel_set_push_msat(uint64_t this_ptr, int64_t val) {
34878         LDKOpenChannel this_ptr_conv;
34879         this_ptr_conv.inner = untag_ptr(this_ptr);
34880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34882         this_ptr_conv.is_owned = false;
34883         OpenChannel_set_push_msat(&this_ptr_conv, val);
34884 }
34885
34886 int64_t  __attribute__((export_name("TS_OpenChannel_get_dust_limit_satoshis"))) TS_OpenChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
34887         LDKOpenChannel this_ptr_conv;
34888         this_ptr_conv.inner = untag_ptr(this_ptr);
34889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34891         this_ptr_conv.is_owned = false;
34892         int64_t ret_conv = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
34893         return ret_conv;
34894 }
34895
34896 void  __attribute__((export_name("TS_OpenChannel_set_dust_limit_satoshis"))) TS_OpenChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
34897         LDKOpenChannel this_ptr_conv;
34898         this_ptr_conv.inner = untag_ptr(this_ptr);
34899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34901         this_ptr_conv.is_owned = false;
34902         OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
34903 }
34904
34905 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) {
34906         LDKOpenChannel this_ptr_conv;
34907         this_ptr_conv.inner = untag_ptr(this_ptr);
34908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34910         this_ptr_conv.is_owned = false;
34911         int64_t ret_conv = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
34912         return ret_conv;
34913 }
34914
34915 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) {
34916         LDKOpenChannel this_ptr_conv;
34917         this_ptr_conv.inner = untag_ptr(this_ptr);
34918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34920         this_ptr_conv.is_owned = false;
34921         OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
34922 }
34923
34924 int64_t  __attribute__((export_name("TS_OpenChannel_get_channel_reserve_satoshis"))) TS_OpenChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
34925         LDKOpenChannel this_ptr_conv;
34926         this_ptr_conv.inner = untag_ptr(this_ptr);
34927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34929         this_ptr_conv.is_owned = false;
34930         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
34931         return ret_conv;
34932 }
34933
34934 void  __attribute__((export_name("TS_OpenChannel_set_channel_reserve_satoshis"))) TS_OpenChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
34935         LDKOpenChannel this_ptr_conv;
34936         this_ptr_conv.inner = untag_ptr(this_ptr);
34937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34939         this_ptr_conv.is_owned = false;
34940         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
34941 }
34942
34943 int64_t  __attribute__((export_name("TS_OpenChannel_get_htlc_minimum_msat"))) TS_OpenChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
34944         LDKOpenChannel this_ptr_conv;
34945         this_ptr_conv.inner = untag_ptr(this_ptr);
34946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34948         this_ptr_conv.is_owned = false;
34949         int64_t ret_conv = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
34950         return ret_conv;
34951 }
34952
34953 void  __attribute__((export_name("TS_OpenChannel_set_htlc_minimum_msat"))) TS_OpenChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
34954         LDKOpenChannel this_ptr_conv;
34955         this_ptr_conv.inner = untag_ptr(this_ptr);
34956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34958         this_ptr_conv.is_owned = false;
34959         OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
34960 }
34961
34962 int32_t  __attribute__((export_name("TS_OpenChannel_get_feerate_per_kw"))) TS_OpenChannel_get_feerate_per_kw(uint64_t this_ptr) {
34963         LDKOpenChannel this_ptr_conv;
34964         this_ptr_conv.inner = untag_ptr(this_ptr);
34965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34967         this_ptr_conv.is_owned = false;
34968         int32_t ret_conv = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
34969         return ret_conv;
34970 }
34971
34972 void  __attribute__((export_name("TS_OpenChannel_set_feerate_per_kw"))) TS_OpenChannel_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
34973         LDKOpenChannel this_ptr_conv;
34974         this_ptr_conv.inner = untag_ptr(this_ptr);
34975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34977         this_ptr_conv.is_owned = false;
34978         OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
34979 }
34980
34981 int16_t  __attribute__((export_name("TS_OpenChannel_get_to_self_delay"))) TS_OpenChannel_get_to_self_delay(uint64_t this_ptr) {
34982         LDKOpenChannel this_ptr_conv;
34983         this_ptr_conv.inner = untag_ptr(this_ptr);
34984         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34986         this_ptr_conv.is_owned = false;
34987         int16_t ret_conv = OpenChannel_get_to_self_delay(&this_ptr_conv);
34988         return ret_conv;
34989 }
34990
34991 void  __attribute__((export_name("TS_OpenChannel_set_to_self_delay"))) TS_OpenChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
34992         LDKOpenChannel this_ptr_conv;
34993         this_ptr_conv.inner = untag_ptr(this_ptr);
34994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
34995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
34996         this_ptr_conv.is_owned = false;
34997         OpenChannel_set_to_self_delay(&this_ptr_conv, val);
34998 }
34999
35000 int16_t  __attribute__((export_name("TS_OpenChannel_get_max_accepted_htlcs"))) TS_OpenChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
35001         LDKOpenChannel this_ptr_conv;
35002         this_ptr_conv.inner = untag_ptr(this_ptr);
35003         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35004         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35005         this_ptr_conv.is_owned = false;
35006         int16_t ret_conv = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
35007         return ret_conv;
35008 }
35009
35010 void  __attribute__((export_name("TS_OpenChannel_set_max_accepted_htlcs"))) TS_OpenChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
35011         LDKOpenChannel this_ptr_conv;
35012         this_ptr_conv.inner = untag_ptr(this_ptr);
35013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35015         this_ptr_conv.is_owned = false;
35016         OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
35017 }
35018
35019 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_funding_pubkey"))) TS_OpenChannel_get_funding_pubkey(uint64_t this_ptr) {
35020         LDKOpenChannel this_ptr_conv;
35021         this_ptr_conv.inner = untag_ptr(this_ptr);
35022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35024         this_ptr_conv.is_owned = false;
35025         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35026         memcpy(ret_arr->elems, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
35027         return ret_arr;
35028 }
35029
35030 void  __attribute__((export_name("TS_OpenChannel_set_funding_pubkey"))) TS_OpenChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
35031         LDKOpenChannel this_ptr_conv;
35032         this_ptr_conv.inner = untag_ptr(this_ptr);
35033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35035         this_ptr_conv.is_owned = false;
35036         LDKPublicKey val_ref;
35037         CHECK(val->arr_len == 33);
35038         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35039         OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
35040 }
35041
35042 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_revocation_basepoint"))) TS_OpenChannel_get_revocation_basepoint(uint64_t this_ptr) {
35043         LDKOpenChannel this_ptr_conv;
35044         this_ptr_conv.inner = untag_ptr(this_ptr);
35045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35047         this_ptr_conv.is_owned = false;
35048         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35049         memcpy(ret_arr->elems, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
35050         return ret_arr;
35051 }
35052
35053 void  __attribute__((export_name("TS_OpenChannel_set_revocation_basepoint"))) TS_OpenChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
35054         LDKOpenChannel this_ptr_conv;
35055         this_ptr_conv.inner = untag_ptr(this_ptr);
35056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35058         this_ptr_conv.is_owned = false;
35059         LDKPublicKey val_ref;
35060         CHECK(val->arr_len == 33);
35061         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35062         OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
35063 }
35064
35065 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_payment_point"))) TS_OpenChannel_get_payment_point(uint64_t this_ptr) {
35066         LDKOpenChannel this_ptr_conv;
35067         this_ptr_conv.inner = untag_ptr(this_ptr);
35068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35070         this_ptr_conv.is_owned = false;
35071         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35072         memcpy(ret_arr->elems, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
35073         return ret_arr;
35074 }
35075
35076 void  __attribute__((export_name("TS_OpenChannel_set_payment_point"))) TS_OpenChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
35077         LDKOpenChannel this_ptr_conv;
35078         this_ptr_conv.inner = untag_ptr(this_ptr);
35079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35081         this_ptr_conv.is_owned = false;
35082         LDKPublicKey val_ref;
35083         CHECK(val->arr_len == 33);
35084         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35085         OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
35086 }
35087
35088 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_delayed_payment_basepoint"))) TS_OpenChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
35089         LDKOpenChannel this_ptr_conv;
35090         this_ptr_conv.inner = untag_ptr(this_ptr);
35091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35093         this_ptr_conv.is_owned = false;
35094         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35095         memcpy(ret_arr->elems, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
35096         return ret_arr;
35097 }
35098
35099 void  __attribute__((export_name("TS_OpenChannel_set_delayed_payment_basepoint"))) TS_OpenChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
35100         LDKOpenChannel this_ptr_conv;
35101         this_ptr_conv.inner = untag_ptr(this_ptr);
35102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35104         this_ptr_conv.is_owned = false;
35105         LDKPublicKey val_ref;
35106         CHECK(val->arr_len == 33);
35107         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35108         OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
35109 }
35110
35111 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_htlc_basepoint"))) TS_OpenChannel_get_htlc_basepoint(uint64_t this_ptr) {
35112         LDKOpenChannel this_ptr_conv;
35113         this_ptr_conv.inner = untag_ptr(this_ptr);
35114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35116         this_ptr_conv.is_owned = false;
35117         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35118         memcpy(ret_arr->elems, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
35119         return ret_arr;
35120 }
35121
35122 void  __attribute__((export_name("TS_OpenChannel_set_htlc_basepoint"))) TS_OpenChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
35123         LDKOpenChannel this_ptr_conv;
35124         this_ptr_conv.inner = untag_ptr(this_ptr);
35125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35127         this_ptr_conv.is_owned = false;
35128         LDKPublicKey val_ref;
35129         CHECK(val->arr_len == 33);
35130         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35131         OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
35132 }
35133
35134 int8_tArray  __attribute__((export_name("TS_OpenChannel_get_first_per_commitment_point"))) TS_OpenChannel_get_first_per_commitment_point(uint64_t this_ptr) {
35135         LDKOpenChannel this_ptr_conv;
35136         this_ptr_conv.inner = untag_ptr(this_ptr);
35137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35139         this_ptr_conv.is_owned = false;
35140         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35141         memcpy(ret_arr->elems, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
35142         return ret_arr;
35143 }
35144
35145 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) {
35146         LDKOpenChannel this_ptr_conv;
35147         this_ptr_conv.inner = untag_ptr(this_ptr);
35148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35150         this_ptr_conv.is_owned = false;
35151         LDKPublicKey val_ref;
35152         CHECK(val->arr_len == 33);
35153         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35154         OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
35155 }
35156
35157 int8_t  __attribute__((export_name("TS_OpenChannel_get_channel_flags"))) TS_OpenChannel_get_channel_flags(uint64_t this_ptr) {
35158         LDKOpenChannel this_ptr_conv;
35159         this_ptr_conv.inner = untag_ptr(this_ptr);
35160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35162         this_ptr_conv.is_owned = false;
35163         int8_t ret_conv = OpenChannel_get_channel_flags(&this_ptr_conv);
35164         return ret_conv;
35165 }
35166
35167 void  __attribute__((export_name("TS_OpenChannel_set_channel_flags"))) TS_OpenChannel_set_channel_flags(uint64_t this_ptr, int8_t val) {
35168         LDKOpenChannel this_ptr_conv;
35169         this_ptr_conv.inner = untag_ptr(this_ptr);
35170         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35172         this_ptr_conv.is_owned = false;
35173         OpenChannel_set_channel_flags(&this_ptr_conv, val);
35174 }
35175
35176 uint64_t  __attribute__((export_name("TS_OpenChannel_get_shutdown_scriptpubkey"))) TS_OpenChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
35177         LDKOpenChannel this_ptr_conv;
35178         this_ptr_conv.inner = untag_ptr(this_ptr);
35179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35181         this_ptr_conv.is_owned = false;
35182         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
35183         *ret_copy = OpenChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
35184         uint64_t ret_ref = tag_ptr(ret_copy, true);
35185         return ret_ref;
35186 }
35187
35188 void  __attribute__((export_name("TS_OpenChannel_set_shutdown_scriptpubkey"))) TS_OpenChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
35189         LDKOpenChannel this_ptr_conv;
35190         this_ptr_conv.inner = untag_ptr(this_ptr);
35191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35193         this_ptr_conv.is_owned = false;
35194         void* val_ptr = untag_ptr(val);
35195         CHECK_ACCESS(val_ptr);
35196         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
35197         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
35198         OpenChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
35199 }
35200
35201 uint64_t  __attribute__((export_name("TS_OpenChannel_get_channel_type"))) TS_OpenChannel_get_channel_type(uint64_t this_ptr) {
35202         LDKOpenChannel this_ptr_conv;
35203         this_ptr_conv.inner = untag_ptr(this_ptr);
35204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35206         this_ptr_conv.is_owned = false;
35207         LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv);
35208         uint64_t ret_ref = 0;
35209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35211         return ret_ref;
35212 }
35213
35214 void  __attribute__((export_name("TS_OpenChannel_set_channel_type"))) TS_OpenChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
35215         LDKOpenChannel this_ptr_conv;
35216         this_ptr_conv.inner = untag_ptr(this_ptr);
35217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35219         this_ptr_conv.is_owned = false;
35220         LDKChannelTypeFeatures val_conv;
35221         val_conv.inner = untag_ptr(val);
35222         val_conv.is_owned = ptr_is_owned(val);
35223         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35224         val_conv = ChannelTypeFeatures_clone(&val_conv);
35225         OpenChannel_set_channel_type(&this_ptr_conv, val_conv);
35226 }
35227
35228 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) {
35229         LDKThirtyTwoBytes chain_hash_arg_ref;
35230         CHECK(chain_hash_arg->arr_len == 32);
35231         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35232         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
35233         CHECK(temporary_channel_id_arg->arr_len == 32);
35234         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
35235         LDKPublicKey funding_pubkey_arg_ref;
35236         CHECK(funding_pubkey_arg->arr_len == 33);
35237         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
35238         LDKPublicKey revocation_basepoint_arg_ref;
35239         CHECK(revocation_basepoint_arg->arr_len == 33);
35240         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
35241         LDKPublicKey payment_point_arg_ref;
35242         CHECK(payment_point_arg->arr_len == 33);
35243         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
35244         LDKPublicKey delayed_payment_basepoint_arg_ref;
35245         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
35246         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
35247         LDKPublicKey htlc_basepoint_arg_ref;
35248         CHECK(htlc_basepoint_arg->arr_len == 33);
35249         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
35250         LDKPublicKey first_per_commitment_point_arg_ref;
35251         CHECK(first_per_commitment_point_arg->arr_len == 33);
35252         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
35253         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
35254         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
35255         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
35256         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
35257         LDKChannelTypeFeatures channel_type_arg_conv;
35258         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
35259         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
35260         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
35261         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
35262         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);
35263         uint64_t ret_ref = 0;
35264         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35265         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35266         return ret_ref;
35267 }
35268
35269 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
35270         LDKOpenChannel ret_var = OpenChannel_clone(arg);
35271         uint64_t ret_ref = 0;
35272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35274         return ret_ref;
35275 }
35276 int64_t  __attribute__((export_name("TS_OpenChannel_clone_ptr"))) TS_OpenChannel_clone_ptr(uint64_t arg) {
35277         LDKOpenChannel arg_conv;
35278         arg_conv.inner = untag_ptr(arg);
35279         arg_conv.is_owned = ptr_is_owned(arg);
35280         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35281         arg_conv.is_owned = false;
35282         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
35283         return ret_conv;
35284 }
35285
35286 uint64_t  __attribute__((export_name("TS_OpenChannel_clone"))) TS_OpenChannel_clone(uint64_t orig) {
35287         LDKOpenChannel orig_conv;
35288         orig_conv.inner = untag_ptr(orig);
35289         orig_conv.is_owned = ptr_is_owned(orig);
35290         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35291         orig_conv.is_owned = false;
35292         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
35293         uint64_t ret_ref = 0;
35294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35296         return ret_ref;
35297 }
35298
35299 jboolean  __attribute__((export_name("TS_OpenChannel_eq"))) TS_OpenChannel_eq(uint64_t a, uint64_t b) {
35300         LDKOpenChannel a_conv;
35301         a_conv.inner = untag_ptr(a);
35302         a_conv.is_owned = ptr_is_owned(a);
35303         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35304         a_conv.is_owned = false;
35305         LDKOpenChannel b_conv;
35306         b_conv.inner = untag_ptr(b);
35307         b_conv.is_owned = ptr_is_owned(b);
35308         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35309         b_conv.is_owned = false;
35310         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
35311         return ret_conv;
35312 }
35313
35314 void  __attribute__((export_name("TS_OpenChannelV2_free"))) TS_OpenChannelV2_free(uint64_t this_obj) {
35315         LDKOpenChannelV2 this_obj_conv;
35316         this_obj_conv.inner = untag_ptr(this_obj);
35317         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35319         OpenChannelV2_free(this_obj_conv);
35320 }
35321
35322 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_chain_hash"))) TS_OpenChannelV2_get_chain_hash(uint64_t this_ptr) {
35323         LDKOpenChannelV2 this_ptr_conv;
35324         this_ptr_conv.inner = untag_ptr(this_ptr);
35325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35327         this_ptr_conv.is_owned = false;
35328         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35329         memcpy(ret_arr->elems, *OpenChannelV2_get_chain_hash(&this_ptr_conv), 32);
35330         return ret_arr;
35331 }
35332
35333 void  __attribute__((export_name("TS_OpenChannelV2_set_chain_hash"))) TS_OpenChannelV2_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
35334         LDKOpenChannelV2 this_ptr_conv;
35335         this_ptr_conv.inner = untag_ptr(this_ptr);
35336         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35337         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35338         this_ptr_conv.is_owned = false;
35339         LDKThirtyTwoBytes val_ref;
35340         CHECK(val->arr_len == 32);
35341         memcpy(val_ref.data, val->elems, 32); FREE(val);
35342         OpenChannelV2_set_chain_hash(&this_ptr_conv, val_ref);
35343 }
35344
35345 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_temporary_channel_id"))) TS_OpenChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
35346         LDKOpenChannelV2 this_ptr_conv;
35347         this_ptr_conv.inner = untag_ptr(this_ptr);
35348         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35350         this_ptr_conv.is_owned = false;
35351         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35352         memcpy(ret_arr->elems, *OpenChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
35353         return ret_arr;
35354 }
35355
35356 void  __attribute__((export_name("TS_OpenChannelV2_set_temporary_channel_id"))) TS_OpenChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
35357         LDKOpenChannelV2 this_ptr_conv;
35358         this_ptr_conv.inner = untag_ptr(this_ptr);
35359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35361         this_ptr_conv.is_owned = false;
35362         LDKThirtyTwoBytes val_ref;
35363         CHECK(val->arr_len == 32);
35364         memcpy(val_ref.data, val->elems, 32); FREE(val);
35365         OpenChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
35366 }
35367
35368 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) {
35369         LDKOpenChannelV2 this_ptr_conv;
35370         this_ptr_conv.inner = untag_ptr(this_ptr);
35371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35373         this_ptr_conv.is_owned = false;
35374         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
35375         return ret_conv;
35376 }
35377
35378 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) {
35379         LDKOpenChannelV2 this_ptr_conv;
35380         this_ptr_conv.inner = untag_ptr(this_ptr);
35381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35383         this_ptr_conv.is_owned = false;
35384         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
35385 }
35386
35387 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) {
35388         LDKOpenChannelV2 this_ptr_conv;
35389         this_ptr_conv.inner = untag_ptr(this_ptr);
35390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35392         this_ptr_conv.is_owned = false;
35393         int32_t ret_conv = OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
35394         return ret_conv;
35395 }
35396
35397 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) {
35398         LDKOpenChannelV2 this_ptr_conv;
35399         this_ptr_conv.inner = untag_ptr(this_ptr);
35400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35402         this_ptr_conv.is_owned = false;
35403         OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
35404 }
35405
35406 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_funding_satoshis"))) TS_OpenChannelV2_get_funding_satoshis(uint64_t this_ptr) {
35407         LDKOpenChannelV2 this_ptr_conv;
35408         this_ptr_conv.inner = untag_ptr(this_ptr);
35409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35411         this_ptr_conv.is_owned = false;
35412         int64_t ret_conv = OpenChannelV2_get_funding_satoshis(&this_ptr_conv);
35413         return ret_conv;
35414 }
35415
35416 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_satoshis"))) TS_OpenChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
35417         LDKOpenChannelV2 this_ptr_conv;
35418         this_ptr_conv.inner = untag_ptr(this_ptr);
35419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35421         this_ptr_conv.is_owned = false;
35422         OpenChannelV2_set_funding_satoshis(&this_ptr_conv, val);
35423 }
35424
35425 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_dust_limit_satoshis"))) TS_OpenChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
35426         LDKOpenChannelV2 this_ptr_conv;
35427         this_ptr_conv.inner = untag_ptr(this_ptr);
35428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35430         this_ptr_conv.is_owned = false;
35431         int64_t ret_conv = OpenChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
35432         return ret_conv;
35433 }
35434
35435 void  __attribute__((export_name("TS_OpenChannelV2_set_dust_limit_satoshis"))) TS_OpenChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
35436         LDKOpenChannelV2 this_ptr_conv;
35437         this_ptr_conv.inner = untag_ptr(this_ptr);
35438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35440         this_ptr_conv.is_owned = false;
35441         OpenChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
35442 }
35443
35444 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) {
35445         LDKOpenChannelV2 this_ptr_conv;
35446         this_ptr_conv.inner = untag_ptr(this_ptr);
35447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35449         this_ptr_conv.is_owned = false;
35450         int64_t ret_conv = OpenChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
35451         return ret_conv;
35452 }
35453
35454 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) {
35455         LDKOpenChannelV2 this_ptr_conv;
35456         this_ptr_conv.inner = untag_ptr(this_ptr);
35457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35459         this_ptr_conv.is_owned = false;
35460         OpenChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
35461 }
35462
35463 int64_t  __attribute__((export_name("TS_OpenChannelV2_get_htlc_minimum_msat"))) TS_OpenChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
35464         LDKOpenChannelV2 this_ptr_conv;
35465         this_ptr_conv.inner = untag_ptr(this_ptr);
35466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35468         this_ptr_conv.is_owned = false;
35469         int64_t ret_conv = OpenChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
35470         return ret_conv;
35471 }
35472
35473 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_minimum_msat"))) TS_OpenChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
35474         LDKOpenChannelV2 this_ptr_conv;
35475         this_ptr_conv.inner = untag_ptr(this_ptr);
35476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35478         this_ptr_conv.is_owned = false;
35479         OpenChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
35480 }
35481
35482 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_to_self_delay"))) TS_OpenChannelV2_get_to_self_delay(uint64_t this_ptr) {
35483         LDKOpenChannelV2 this_ptr_conv;
35484         this_ptr_conv.inner = untag_ptr(this_ptr);
35485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35487         this_ptr_conv.is_owned = false;
35488         int16_t ret_conv = OpenChannelV2_get_to_self_delay(&this_ptr_conv);
35489         return ret_conv;
35490 }
35491
35492 void  __attribute__((export_name("TS_OpenChannelV2_set_to_self_delay"))) TS_OpenChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
35493         LDKOpenChannelV2 this_ptr_conv;
35494         this_ptr_conv.inner = untag_ptr(this_ptr);
35495         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35497         this_ptr_conv.is_owned = false;
35498         OpenChannelV2_set_to_self_delay(&this_ptr_conv, val);
35499 }
35500
35501 int16_t  __attribute__((export_name("TS_OpenChannelV2_get_max_accepted_htlcs"))) TS_OpenChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
35502         LDKOpenChannelV2 this_ptr_conv;
35503         this_ptr_conv.inner = untag_ptr(this_ptr);
35504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35506         this_ptr_conv.is_owned = false;
35507         int16_t ret_conv = OpenChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
35508         return ret_conv;
35509 }
35510
35511 void  __attribute__((export_name("TS_OpenChannelV2_set_max_accepted_htlcs"))) TS_OpenChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
35512         LDKOpenChannelV2 this_ptr_conv;
35513         this_ptr_conv.inner = untag_ptr(this_ptr);
35514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35516         this_ptr_conv.is_owned = false;
35517         OpenChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
35518 }
35519
35520 int32_t  __attribute__((export_name("TS_OpenChannelV2_get_locktime"))) TS_OpenChannelV2_get_locktime(uint64_t this_ptr) {
35521         LDKOpenChannelV2 this_ptr_conv;
35522         this_ptr_conv.inner = untag_ptr(this_ptr);
35523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35525         this_ptr_conv.is_owned = false;
35526         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
35527         return ret_conv;
35528 }
35529
35530 void  __attribute__((export_name("TS_OpenChannelV2_set_locktime"))) TS_OpenChannelV2_set_locktime(uint64_t this_ptr, int32_t val) {
35531         LDKOpenChannelV2 this_ptr_conv;
35532         this_ptr_conv.inner = untag_ptr(this_ptr);
35533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35535         this_ptr_conv.is_owned = false;
35536         OpenChannelV2_set_locktime(&this_ptr_conv, val);
35537 }
35538
35539 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_funding_pubkey"))) TS_OpenChannelV2_get_funding_pubkey(uint64_t this_ptr) {
35540         LDKOpenChannelV2 this_ptr_conv;
35541         this_ptr_conv.inner = untag_ptr(this_ptr);
35542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35544         this_ptr_conv.is_owned = false;
35545         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35546         memcpy(ret_arr->elems, OpenChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
35547         return ret_arr;
35548 }
35549
35550 void  __attribute__((export_name("TS_OpenChannelV2_set_funding_pubkey"))) TS_OpenChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
35551         LDKOpenChannelV2 this_ptr_conv;
35552         this_ptr_conv.inner = untag_ptr(this_ptr);
35553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35555         this_ptr_conv.is_owned = false;
35556         LDKPublicKey val_ref;
35557         CHECK(val->arr_len == 33);
35558         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35559         OpenChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
35560 }
35561
35562 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_revocation_basepoint"))) TS_OpenChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
35563         LDKOpenChannelV2 this_ptr_conv;
35564         this_ptr_conv.inner = untag_ptr(this_ptr);
35565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35567         this_ptr_conv.is_owned = false;
35568         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35569         memcpy(ret_arr->elems, OpenChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
35570         return ret_arr;
35571 }
35572
35573 void  __attribute__((export_name("TS_OpenChannelV2_set_revocation_basepoint"))) TS_OpenChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
35574         LDKOpenChannelV2 this_ptr_conv;
35575         this_ptr_conv.inner = untag_ptr(this_ptr);
35576         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35578         this_ptr_conv.is_owned = false;
35579         LDKPublicKey val_ref;
35580         CHECK(val->arr_len == 33);
35581         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35582         OpenChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
35583 }
35584
35585 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_payment_basepoint"))) TS_OpenChannelV2_get_payment_basepoint(uint64_t this_ptr) {
35586         LDKOpenChannelV2 this_ptr_conv;
35587         this_ptr_conv.inner = untag_ptr(this_ptr);
35588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35590         this_ptr_conv.is_owned = false;
35591         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35592         memcpy(ret_arr->elems, OpenChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
35593         return ret_arr;
35594 }
35595
35596 void  __attribute__((export_name("TS_OpenChannelV2_set_payment_basepoint"))) TS_OpenChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
35597         LDKOpenChannelV2 this_ptr_conv;
35598         this_ptr_conv.inner = untag_ptr(this_ptr);
35599         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35601         this_ptr_conv.is_owned = false;
35602         LDKPublicKey val_ref;
35603         CHECK(val->arr_len == 33);
35604         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35605         OpenChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
35606 }
35607
35608 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_delayed_payment_basepoint"))) TS_OpenChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
35609         LDKOpenChannelV2 this_ptr_conv;
35610         this_ptr_conv.inner = untag_ptr(this_ptr);
35611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35613         this_ptr_conv.is_owned = false;
35614         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35615         memcpy(ret_arr->elems, OpenChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
35616         return ret_arr;
35617 }
35618
35619 void  __attribute__((export_name("TS_OpenChannelV2_set_delayed_payment_basepoint"))) TS_OpenChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
35620         LDKOpenChannelV2 this_ptr_conv;
35621         this_ptr_conv.inner = untag_ptr(this_ptr);
35622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35624         this_ptr_conv.is_owned = false;
35625         LDKPublicKey val_ref;
35626         CHECK(val->arr_len == 33);
35627         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35628         OpenChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
35629 }
35630
35631 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_htlc_basepoint"))) TS_OpenChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
35632         LDKOpenChannelV2 this_ptr_conv;
35633         this_ptr_conv.inner = untag_ptr(this_ptr);
35634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35636         this_ptr_conv.is_owned = false;
35637         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35638         memcpy(ret_arr->elems, OpenChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
35639         return ret_arr;
35640 }
35641
35642 void  __attribute__((export_name("TS_OpenChannelV2_set_htlc_basepoint"))) TS_OpenChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
35643         LDKOpenChannelV2 this_ptr_conv;
35644         this_ptr_conv.inner = untag_ptr(this_ptr);
35645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35647         this_ptr_conv.is_owned = false;
35648         LDKPublicKey val_ref;
35649         CHECK(val->arr_len == 33);
35650         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35651         OpenChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
35652 }
35653
35654 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_first_per_commitment_point"))) TS_OpenChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
35655         LDKOpenChannelV2 this_ptr_conv;
35656         this_ptr_conv.inner = untag_ptr(this_ptr);
35657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35659         this_ptr_conv.is_owned = false;
35660         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35661         memcpy(ret_arr->elems, OpenChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
35662         return ret_arr;
35663 }
35664
35665 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) {
35666         LDKOpenChannelV2 this_ptr_conv;
35667         this_ptr_conv.inner = untag_ptr(this_ptr);
35668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35670         this_ptr_conv.is_owned = false;
35671         LDKPublicKey val_ref;
35672         CHECK(val->arr_len == 33);
35673         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35674         OpenChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
35675 }
35676
35677 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_get_second_per_commitment_point"))) TS_OpenChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
35678         LDKOpenChannelV2 this_ptr_conv;
35679         this_ptr_conv.inner = untag_ptr(this_ptr);
35680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35682         this_ptr_conv.is_owned = false;
35683         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
35684         memcpy(ret_arr->elems, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
35685         return ret_arr;
35686 }
35687
35688 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) {
35689         LDKOpenChannelV2 this_ptr_conv;
35690         this_ptr_conv.inner = untag_ptr(this_ptr);
35691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35693         this_ptr_conv.is_owned = false;
35694         LDKPublicKey val_ref;
35695         CHECK(val->arr_len == 33);
35696         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
35697         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
35698 }
35699
35700 int8_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_flags"))) TS_OpenChannelV2_get_channel_flags(uint64_t this_ptr) {
35701         LDKOpenChannelV2 this_ptr_conv;
35702         this_ptr_conv.inner = untag_ptr(this_ptr);
35703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35705         this_ptr_conv.is_owned = false;
35706         int8_t ret_conv = OpenChannelV2_get_channel_flags(&this_ptr_conv);
35707         return ret_conv;
35708 }
35709
35710 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_flags"))) TS_OpenChannelV2_set_channel_flags(uint64_t this_ptr, int8_t val) {
35711         LDKOpenChannelV2 this_ptr_conv;
35712         this_ptr_conv.inner = untag_ptr(this_ptr);
35713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35715         this_ptr_conv.is_owned = false;
35716         OpenChannelV2_set_channel_flags(&this_ptr_conv, val);
35717 }
35718
35719 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_shutdown_scriptpubkey"))) TS_OpenChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
35720         LDKOpenChannelV2 this_ptr_conv;
35721         this_ptr_conv.inner = untag_ptr(this_ptr);
35722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35724         this_ptr_conv.is_owned = false;
35725         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
35726         *ret_copy = OpenChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
35727         uint64_t ret_ref = tag_ptr(ret_copy, true);
35728         return ret_ref;
35729 }
35730
35731 void  __attribute__((export_name("TS_OpenChannelV2_set_shutdown_scriptpubkey"))) TS_OpenChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
35732         LDKOpenChannelV2 this_ptr_conv;
35733         this_ptr_conv.inner = untag_ptr(this_ptr);
35734         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35736         this_ptr_conv.is_owned = false;
35737         void* val_ptr = untag_ptr(val);
35738         CHECK_ACCESS(val_ptr);
35739         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
35740         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
35741         OpenChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
35742 }
35743
35744 uint64_t  __attribute__((export_name("TS_OpenChannelV2_get_channel_type"))) TS_OpenChannelV2_get_channel_type(uint64_t this_ptr) {
35745         LDKOpenChannelV2 this_ptr_conv;
35746         this_ptr_conv.inner = untag_ptr(this_ptr);
35747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35749         this_ptr_conv.is_owned = false;
35750         LDKChannelTypeFeatures ret_var = OpenChannelV2_get_channel_type(&this_ptr_conv);
35751         uint64_t ret_ref = 0;
35752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35754         return ret_ref;
35755 }
35756
35757 void  __attribute__((export_name("TS_OpenChannelV2_set_channel_type"))) TS_OpenChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
35758         LDKOpenChannelV2 this_ptr_conv;
35759         this_ptr_conv.inner = untag_ptr(this_ptr);
35760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35762         this_ptr_conv.is_owned = false;
35763         LDKChannelTypeFeatures val_conv;
35764         val_conv.inner = untag_ptr(val);
35765         val_conv.is_owned = ptr_is_owned(val);
35766         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
35767         val_conv = ChannelTypeFeatures_clone(&val_conv);
35768         OpenChannelV2_set_channel_type(&this_ptr_conv, val_conv);
35769 }
35770
35771 uint32_t  __attribute__((export_name("TS_OpenChannelV2_get_require_confirmed_inputs"))) TS_OpenChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
35772         LDKOpenChannelV2 this_ptr_conv;
35773         this_ptr_conv.inner = untag_ptr(this_ptr);
35774         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35776         this_ptr_conv.is_owned = false;
35777         uint32_t ret_conv = LDKCOption_NoneZ_to_js(OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
35778         return ret_conv;
35779 }
35780
35781 void  __attribute__((export_name("TS_OpenChannelV2_set_require_confirmed_inputs"))) TS_OpenChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
35782         LDKOpenChannelV2 this_ptr_conv;
35783         this_ptr_conv.inner = untag_ptr(this_ptr);
35784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35786         this_ptr_conv.is_owned = false;
35787         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
35788         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
35789 }
35790
35791 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) {
35792         LDKThirtyTwoBytes chain_hash_arg_ref;
35793         CHECK(chain_hash_arg->arr_len == 32);
35794         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
35795         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
35796         CHECK(temporary_channel_id_arg->arr_len == 32);
35797         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
35798         LDKPublicKey funding_pubkey_arg_ref;
35799         CHECK(funding_pubkey_arg->arr_len == 33);
35800         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
35801         LDKPublicKey revocation_basepoint_arg_ref;
35802         CHECK(revocation_basepoint_arg->arr_len == 33);
35803         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
35804         LDKPublicKey payment_basepoint_arg_ref;
35805         CHECK(payment_basepoint_arg->arr_len == 33);
35806         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
35807         LDKPublicKey delayed_payment_basepoint_arg_ref;
35808         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
35809         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
35810         LDKPublicKey htlc_basepoint_arg_ref;
35811         CHECK(htlc_basepoint_arg->arr_len == 33);
35812         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
35813         LDKPublicKey first_per_commitment_point_arg_ref;
35814         CHECK(first_per_commitment_point_arg->arr_len == 33);
35815         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
35816         LDKPublicKey second_per_commitment_point_arg_ref;
35817         CHECK(second_per_commitment_point_arg->arr_len == 33);
35818         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
35819         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
35820         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
35821         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
35822         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
35823         LDKChannelTypeFeatures channel_type_arg_conv;
35824         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
35825         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
35826         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
35827         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
35828         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
35829         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);
35830         uint64_t ret_ref = 0;
35831         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35832         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35833         return ret_ref;
35834 }
35835
35836 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
35837         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
35838         uint64_t ret_ref = 0;
35839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35841         return ret_ref;
35842 }
35843 int64_t  __attribute__((export_name("TS_OpenChannelV2_clone_ptr"))) TS_OpenChannelV2_clone_ptr(uint64_t arg) {
35844         LDKOpenChannelV2 arg_conv;
35845         arg_conv.inner = untag_ptr(arg);
35846         arg_conv.is_owned = ptr_is_owned(arg);
35847         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
35848         arg_conv.is_owned = false;
35849         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
35850         return ret_conv;
35851 }
35852
35853 uint64_t  __attribute__((export_name("TS_OpenChannelV2_clone"))) TS_OpenChannelV2_clone(uint64_t orig) {
35854         LDKOpenChannelV2 orig_conv;
35855         orig_conv.inner = untag_ptr(orig);
35856         orig_conv.is_owned = ptr_is_owned(orig);
35857         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
35858         orig_conv.is_owned = false;
35859         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
35860         uint64_t ret_ref = 0;
35861         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
35862         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
35863         return ret_ref;
35864 }
35865
35866 jboolean  __attribute__((export_name("TS_OpenChannelV2_eq"))) TS_OpenChannelV2_eq(uint64_t a, uint64_t b) {
35867         LDKOpenChannelV2 a_conv;
35868         a_conv.inner = untag_ptr(a);
35869         a_conv.is_owned = ptr_is_owned(a);
35870         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
35871         a_conv.is_owned = false;
35872         LDKOpenChannelV2 b_conv;
35873         b_conv.inner = untag_ptr(b);
35874         b_conv.is_owned = ptr_is_owned(b);
35875         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
35876         b_conv.is_owned = false;
35877         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
35878         return ret_conv;
35879 }
35880
35881 void  __attribute__((export_name("TS_AcceptChannel_free"))) TS_AcceptChannel_free(uint64_t this_obj) {
35882         LDKAcceptChannel this_obj_conv;
35883         this_obj_conv.inner = untag_ptr(this_obj);
35884         this_obj_conv.is_owned = ptr_is_owned(this_obj);
35885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
35886         AcceptChannel_free(this_obj_conv);
35887 }
35888
35889 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_temporary_channel_id"))) TS_AcceptChannel_get_temporary_channel_id(uint64_t this_ptr) {
35890         LDKAcceptChannel this_ptr_conv;
35891         this_ptr_conv.inner = untag_ptr(this_ptr);
35892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35894         this_ptr_conv.is_owned = false;
35895         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
35896         memcpy(ret_arr->elems, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv), 32);
35897         return ret_arr;
35898 }
35899
35900 void  __attribute__((export_name("TS_AcceptChannel_set_temporary_channel_id"))) TS_AcceptChannel_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
35901         LDKAcceptChannel this_ptr_conv;
35902         this_ptr_conv.inner = untag_ptr(this_ptr);
35903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35905         this_ptr_conv.is_owned = false;
35906         LDKThirtyTwoBytes val_ref;
35907         CHECK(val->arr_len == 32);
35908         memcpy(val_ref.data, val->elems, 32); FREE(val);
35909         AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
35910 }
35911
35912 int64_t  __attribute__((export_name("TS_AcceptChannel_get_dust_limit_satoshis"))) TS_AcceptChannel_get_dust_limit_satoshis(uint64_t this_ptr) {
35913         LDKAcceptChannel 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         int64_t ret_conv = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
35919         return ret_conv;
35920 }
35921
35922 void  __attribute__((export_name("TS_AcceptChannel_set_dust_limit_satoshis"))) TS_AcceptChannel_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
35923         LDKAcceptChannel this_ptr_conv;
35924         this_ptr_conv.inner = untag_ptr(this_ptr);
35925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35927         this_ptr_conv.is_owned = false;
35928         AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
35929 }
35930
35931 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) {
35932         LDKAcceptChannel this_ptr_conv;
35933         this_ptr_conv.inner = untag_ptr(this_ptr);
35934         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35936         this_ptr_conv.is_owned = false;
35937         int64_t ret_conv = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
35938         return ret_conv;
35939 }
35940
35941 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) {
35942         LDKAcceptChannel this_ptr_conv;
35943         this_ptr_conv.inner = untag_ptr(this_ptr);
35944         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35946         this_ptr_conv.is_owned = false;
35947         AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
35948 }
35949
35950 int64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_reserve_satoshis"))) TS_AcceptChannel_get_channel_reserve_satoshis(uint64_t this_ptr) {
35951         LDKAcceptChannel 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         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
35957         return ret_conv;
35958 }
35959
35960 void  __attribute__((export_name("TS_AcceptChannel_set_channel_reserve_satoshis"))) TS_AcceptChannel_set_channel_reserve_satoshis(uint64_t this_ptr, int64_t val) {
35961         LDKAcceptChannel this_ptr_conv;
35962         this_ptr_conv.inner = untag_ptr(this_ptr);
35963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35965         this_ptr_conv.is_owned = false;
35966         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
35967 }
35968
35969 int64_t  __attribute__((export_name("TS_AcceptChannel_get_htlc_minimum_msat"))) TS_AcceptChannel_get_htlc_minimum_msat(uint64_t this_ptr) {
35970         LDKAcceptChannel this_ptr_conv;
35971         this_ptr_conv.inner = untag_ptr(this_ptr);
35972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35974         this_ptr_conv.is_owned = false;
35975         int64_t ret_conv = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
35976         return ret_conv;
35977 }
35978
35979 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_minimum_msat"))) TS_AcceptChannel_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
35980         LDKAcceptChannel this_ptr_conv;
35981         this_ptr_conv.inner = untag_ptr(this_ptr);
35982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35984         this_ptr_conv.is_owned = false;
35985         AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
35986 }
35987
35988 int32_t  __attribute__((export_name("TS_AcceptChannel_get_minimum_depth"))) TS_AcceptChannel_get_minimum_depth(uint64_t this_ptr) {
35989         LDKAcceptChannel this_ptr_conv;
35990         this_ptr_conv.inner = untag_ptr(this_ptr);
35991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
35992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
35993         this_ptr_conv.is_owned = false;
35994         int32_t ret_conv = AcceptChannel_get_minimum_depth(&this_ptr_conv);
35995         return ret_conv;
35996 }
35997
35998 void  __attribute__((export_name("TS_AcceptChannel_set_minimum_depth"))) TS_AcceptChannel_set_minimum_depth(uint64_t this_ptr, int32_t val) {
35999         LDKAcceptChannel this_ptr_conv;
36000         this_ptr_conv.inner = untag_ptr(this_ptr);
36001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36003         this_ptr_conv.is_owned = false;
36004         AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
36005 }
36006
36007 int16_t  __attribute__((export_name("TS_AcceptChannel_get_to_self_delay"))) TS_AcceptChannel_get_to_self_delay(uint64_t this_ptr) {
36008         LDKAcceptChannel this_ptr_conv;
36009         this_ptr_conv.inner = untag_ptr(this_ptr);
36010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36012         this_ptr_conv.is_owned = false;
36013         int16_t ret_conv = AcceptChannel_get_to_self_delay(&this_ptr_conv);
36014         return ret_conv;
36015 }
36016
36017 void  __attribute__((export_name("TS_AcceptChannel_set_to_self_delay"))) TS_AcceptChannel_set_to_self_delay(uint64_t this_ptr, int16_t val) {
36018         LDKAcceptChannel this_ptr_conv;
36019         this_ptr_conv.inner = untag_ptr(this_ptr);
36020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36022         this_ptr_conv.is_owned = false;
36023         AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
36024 }
36025
36026 int16_t  __attribute__((export_name("TS_AcceptChannel_get_max_accepted_htlcs"))) TS_AcceptChannel_get_max_accepted_htlcs(uint64_t this_ptr) {
36027         LDKAcceptChannel this_ptr_conv;
36028         this_ptr_conv.inner = untag_ptr(this_ptr);
36029         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36030         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36031         this_ptr_conv.is_owned = false;
36032         int16_t ret_conv = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
36033         return ret_conv;
36034 }
36035
36036 void  __attribute__((export_name("TS_AcceptChannel_set_max_accepted_htlcs"))) TS_AcceptChannel_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
36037         LDKAcceptChannel this_ptr_conv;
36038         this_ptr_conv.inner = untag_ptr(this_ptr);
36039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36041         this_ptr_conv.is_owned = false;
36042         AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
36043 }
36044
36045 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_funding_pubkey"))) TS_AcceptChannel_get_funding_pubkey(uint64_t this_ptr) {
36046         LDKAcceptChannel this_ptr_conv;
36047         this_ptr_conv.inner = untag_ptr(this_ptr);
36048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36050         this_ptr_conv.is_owned = false;
36051         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36052         memcpy(ret_arr->elems, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
36053         return ret_arr;
36054 }
36055
36056 void  __attribute__((export_name("TS_AcceptChannel_set_funding_pubkey"))) TS_AcceptChannel_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
36057         LDKAcceptChannel this_ptr_conv;
36058         this_ptr_conv.inner = untag_ptr(this_ptr);
36059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36061         this_ptr_conv.is_owned = false;
36062         LDKPublicKey val_ref;
36063         CHECK(val->arr_len == 33);
36064         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36065         AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
36066 }
36067
36068 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_revocation_basepoint"))) TS_AcceptChannel_get_revocation_basepoint(uint64_t this_ptr) {
36069         LDKAcceptChannel this_ptr_conv;
36070         this_ptr_conv.inner = untag_ptr(this_ptr);
36071         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36073         this_ptr_conv.is_owned = false;
36074         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36075         memcpy(ret_arr->elems, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
36076         return ret_arr;
36077 }
36078
36079 void  __attribute__((export_name("TS_AcceptChannel_set_revocation_basepoint"))) TS_AcceptChannel_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
36080         LDKAcceptChannel this_ptr_conv;
36081         this_ptr_conv.inner = untag_ptr(this_ptr);
36082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36084         this_ptr_conv.is_owned = false;
36085         LDKPublicKey val_ref;
36086         CHECK(val->arr_len == 33);
36087         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36088         AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
36089 }
36090
36091 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_payment_point"))) TS_AcceptChannel_get_payment_point(uint64_t this_ptr) {
36092         LDKAcceptChannel this_ptr_conv;
36093         this_ptr_conv.inner = untag_ptr(this_ptr);
36094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36096         this_ptr_conv.is_owned = false;
36097         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36098         memcpy(ret_arr->elems, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33);
36099         return ret_arr;
36100 }
36101
36102 void  __attribute__((export_name("TS_AcceptChannel_set_payment_point"))) TS_AcceptChannel_set_payment_point(uint64_t this_ptr, int8_tArray val) {
36103         LDKAcceptChannel this_ptr_conv;
36104         this_ptr_conv.inner = untag_ptr(this_ptr);
36105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36107         this_ptr_conv.is_owned = false;
36108         LDKPublicKey val_ref;
36109         CHECK(val->arr_len == 33);
36110         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36111         AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
36112 }
36113
36114 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_delayed_payment_basepoint"))) TS_AcceptChannel_get_delayed_payment_basepoint(uint64_t this_ptr) {
36115         LDKAcceptChannel this_ptr_conv;
36116         this_ptr_conv.inner = untag_ptr(this_ptr);
36117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36119         this_ptr_conv.is_owned = false;
36120         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36121         memcpy(ret_arr->elems, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
36122         return ret_arr;
36123 }
36124
36125 void  __attribute__((export_name("TS_AcceptChannel_set_delayed_payment_basepoint"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
36126         LDKAcceptChannel this_ptr_conv;
36127         this_ptr_conv.inner = untag_ptr(this_ptr);
36128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36130         this_ptr_conv.is_owned = false;
36131         LDKPublicKey val_ref;
36132         CHECK(val->arr_len == 33);
36133         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36134         AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
36135 }
36136
36137 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_htlc_basepoint"))) TS_AcceptChannel_get_htlc_basepoint(uint64_t this_ptr) {
36138         LDKAcceptChannel this_ptr_conv;
36139         this_ptr_conv.inner = untag_ptr(this_ptr);
36140         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36142         this_ptr_conv.is_owned = false;
36143         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36144         memcpy(ret_arr->elems, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
36145         return ret_arr;
36146 }
36147
36148 void  __attribute__((export_name("TS_AcceptChannel_set_htlc_basepoint"))) TS_AcceptChannel_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
36149         LDKAcceptChannel this_ptr_conv;
36150         this_ptr_conv.inner = untag_ptr(this_ptr);
36151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36153         this_ptr_conv.is_owned = false;
36154         LDKPublicKey val_ref;
36155         CHECK(val->arr_len == 33);
36156         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36157         AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
36158 }
36159
36160 int8_tArray  __attribute__((export_name("TS_AcceptChannel_get_first_per_commitment_point"))) TS_AcceptChannel_get_first_per_commitment_point(uint64_t this_ptr) {
36161         LDKAcceptChannel this_ptr_conv;
36162         this_ptr_conv.inner = untag_ptr(this_ptr);
36163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36165         this_ptr_conv.is_owned = false;
36166         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36167         memcpy(ret_arr->elems, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
36168         return ret_arr;
36169 }
36170
36171 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) {
36172         LDKAcceptChannel this_ptr_conv;
36173         this_ptr_conv.inner = untag_ptr(this_ptr);
36174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36176         this_ptr_conv.is_owned = false;
36177         LDKPublicKey val_ref;
36178         CHECK(val->arr_len == 33);
36179         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36180         AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
36181 }
36182
36183 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_shutdown_scriptpubkey"))) TS_AcceptChannel_get_shutdown_scriptpubkey(uint64_t this_ptr) {
36184         LDKAcceptChannel this_ptr_conv;
36185         this_ptr_conv.inner = untag_ptr(this_ptr);
36186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36188         this_ptr_conv.is_owned = false;
36189         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
36190         *ret_copy = AcceptChannel_get_shutdown_scriptpubkey(&this_ptr_conv);
36191         uint64_t ret_ref = tag_ptr(ret_copy, true);
36192         return ret_ref;
36193 }
36194
36195 void  __attribute__((export_name("TS_AcceptChannel_set_shutdown_scriptpubkey"))) TS_AcceptChannel_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
36196         LDKAcceptChannel this_ptr_conv;
36197         this_ptr_conv.inner = untag_ptr(this_ptr);
36198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36200         this_ptr_conv.is_owned = false;
36201         void* val_ptr = untag_ptr(val);
36202         CHECK_ACCESS(val_ptr);
36203         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
36204         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
36205         AcceptChannel_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
36206 }
36207
36208 uint64_t  __attribute__((export_name("TS_AcceptChannel_get_channel_type"))) TS_AcceptChannel_get_channel_type(uint64_t this_ptr) {
36209         LDKAcceptChannel this_ptr_conv;
36210         this_ptr_conv.inner = untag_ptr(this_ptr);
36211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36213         this_ptr_conv.is_owned = false;
36214         LDKChannelTypeFeatures ret_var = AcceptChannel_get_channel_type(&this_ptr_conv);
36215         uint64_t ret_ref = 0;
36216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36218         return ret_ref;
36219 }
36220
36221 void  __attribute__((export_name("TS_AcceptChannel_set_channel_type"))) TS_AcceptChannel_set_channel_type(uint64_t this_ptr, uint64_t val) {
36222         LDKAcceptChannel this_ptr_conv;
36223         this_ptr_conv.inner = untag_ptr(this_ptr);
36224         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36225         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36226         this_ptr_conv.is_owned = false;
36227         LDKChannelTypeFeatures val_conv;
36228         val_conv.inner = untag_ptr(val);
36229         val_conv.is_owned = ptr_is_owned(val);
36230         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36231         val_conv = ChannelTypeFeatures_clone(&val_conv);
36232         AcceptChannel_set_channel_type(&this_ptr_conv, val_conv);
36233 }
36234
36235 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) {
36236         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
36237         CHECK(temporary_channel_id_arg->arr_len == 32);
36238         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
36239         LDKPublicKey funding_pubkey_arg_ref;
36240         CHECK(funding_pubkey_arg->arr_len == 33);
36241         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
36242         LDKPublicKey revocation_basepoint_arg_ref;
36243         CHECK(revocation_basepoint_arg->arr_len == 33);
36244         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
36245         LDKPublicKey payment_point_arg_ref;
36246         CHECK(payment_point_arg->arr_len == 33);
36247         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
36248         LDKPublicKey delayed_payment_basepoint_arg_ref;
36249         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
36250         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
36251         LDKPublicKey htlc_basepoint_arg_ref;
36252         CHECK(htlc_basepoint_arg->arr_len == 33);
36253         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
36254         LDKPublicKey first_per_commitment_point_arg_ref;
36255         CHECK(first_per_commitment_point_arg->arr_len == 33);
36256         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
36257         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
36258         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
36259         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
36260         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
36261         LDKChannelTypeFeatures channel_type_arg_conv;
36262         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
36263         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
36264         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
36265         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
36266         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);
36267         uint64_t ret_ref = 0;
36268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36270         return ret_ref;
36271 }
36272
36273 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
36274         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
36275         uint64_t ret_ref = 0;
36276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36278         return ret_ref;
36279 }
36280 int64_t  __attribute__((export_name("TS_AcceptChannel_clone_ptr"))) TS_AcceptChannel_clone_ptr(uint64_t arg) {
36281         LDKAcceptChannel arg_conv;
36282         arg_conv.inner = untag_ptr(arg);
36283         arg_conv.is_owned = ptr_is_owned(arg);
36284         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36285         arg_conv.is_owned = false;
36286         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
36287         return ret_conv;
36288 }
36289
36290 uint64_t  __attribute__((export_name("TS_AcceptChannel_clone"))) TS_AcceptChannel_clone(uint64_t orig) {
36291         LDKAcceptChannel orig_conv;
36292         orig_conv.inner = untag_ptr(orig);
36293         orig_conv.is_owned = ptr_is_owned(orig);
36294         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36295         orig_conv.is_owned = false;
36296         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
36297         uint64_t ret_ref = 0;
36298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36300         return ret_ref;
36301 }
36302
36303 jboolean  __attribute__((export_name("TS_AcceptChannel_eq"))) TS_AcceptChannel_eq(uint64_t a, uint64_t b) {
36304         LDKAcceptChannel a_conv;
36305         a_conv.inner = untag_ptr(a);
36306         a_conv.is_owned = ptr_is_owned(a);
36307         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36308         a_conv.is_owned = false;
36309         LDKAcceptChannel b_conv;
36310         b_conv.inner = untag_ptr(b);
36311         b_conv.is_owned = ptr_is_owned(b);
36312         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36313         b_conv.is_owned = false;
36314         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
36315         return ret_conv;
36316 }
36317
36318 void  __attribute__((export_name("TS_AcceptChannelV2_free"))) TS_AcceptChannelV2_free(uint64_t this_obj) {
36319         LDKAcceptChannelV2 this_obj_conv;
36320         this_obj_conv.inner = untag_ptr(this_obj);
36321         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36323         AcceptChannelV2_free(this_obj_conv);
36324 }
36325
36326 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_temporary_channel_id"))) TS_AcceptChannelV2_get_temporary_channel_id(uint64_t this_ptr) {
36327         LDKAcceptChannelV2 this_ptr_conv;
36328         this_ptr_conv.inner = untag_ptr(this_ptr);
36329         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36331         this_ptr_conv.is_owned = false;
36332         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36333         memcpy(ret_arr->elems, *AcceptChannelV2_get_temporary_channel_id(&this_ptr_conv), 32);
36334         return ret_arr;
36335 }
36336
36337 void  __attribute__((export_name("TS_AcceptChannelV2_set_temporary_channel_id"))) TS_AcceptChannelV2_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
36338         LDKAcceptChannelV2 this_ptr_conv;
36339         this_ptr_conv.inner = untag_ptr(this_ptr);
36340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36342         this_ptr_conv.is_owned = false;
36343         LDKThirtyTwoBytes val_ref;
36344         CHECK(val->arr_len == 32);
36345         memcpy(val_ref.data, val->elems, 32); FREE(val);
36346         AcceptChannelV2_set_temporary_channel_id(&this_ptr_conv, val_ref);
36347 }
36348
36349 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_funding_satoshis"))) TS_AcceptChannelV2_get_funding_satoshis(uint64_t this_ptr) {
36350         LDKAcceptChannelV2 this_ptr_conv;
36351         this_ptr_conv.inner = untag_ptr(this_ptr);
36352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36354         this_ptr_conv.is_owned = false;
36355         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
36356         return ret_conv;
36357 }
36358
36359 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_satoshis"))) TS_AcceptChannelV2_set_funding_satoshis(uint64_t this_ptr, int64_t val) {
36360         LDKAcceptChannelV2 this_ptr_conv;
36361         this_ptr_conv.inner = untag_ptr(this_ptr);
36362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36364         this_ptr_conv.is_owned = false;
36365         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
36366 }
36367
36368 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_dust_limit_satoshis"))) TS_AcceptChannelV2_get_dust_limit_satoshis(uint64_t this_ptr) {
36369         LDKAcceptChannelV2 this_ptr_conv;
36370         this_ptr_conv.inner = untag_ptr(this_ptr);
36371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36373         this_ptr_conv.is_owned = false;
36374         int64_t ret_conv = AcceptChannelV2_get_dust_limit_satoshis(&this_ptr_conv);
36375         return ret_conv;
36376 }
36377
36378 void  __attribute__((export_name("TS_AcceptChannelV2_set_dust_limit_satoshis"))) TS_AcceptChannelV2_set_dust_limit_satoshis(uint64_t this_ptr, int64_t val) {
36379         LDKAcceptChannelV2 this_ptr_conv;
36380         this_ptr_conv.inner = untag_ptr(this_ptr);
36381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36383         this_ptr_conv.is_owned = false;
36384         AcceptChannelV2_set_dust_limit_satoshis(&this_ptr_conv, val);
36385 }
36386
36387 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) {
36388         LDKAcceptChannelV2 this_ptr_conv;
36389         this_ptr_conv.inner = untag_ptr(this_ptr);
36390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36392         this_ptr_conv.is_owned = false;
36393         int64_t ret_conv = AcceptChannelV2_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
36394         return ret_conv;
36395 }
36396
36397 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) {
36398         LDKAcceptChannelV2 this_ptr_conv;
36399         this_ptr_conv.inner = untag_ptr(this_ptr);
36400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36402         this_ptr_conv.is_owned = false;
36403         AcceptChannelV2_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
36404 }
36405
36406 int64_t  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_minimum_msat"))) TS_AcceptChannelV2_get_htlc_minimum_msat(uint64_t this_ptr) {
36407         LDKAcceptChannelV2 this_ptr_conv;
36408         this_ptr_conv.inner = untag_ptr(this_ptr);
36409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36411         this_ptr_conv.is_owned = false;
36412         int64_t ret_conv = AcceptChannelV2_get_htlc_minimum_msat(&this_ptr_conv);
36413         return ret_conv;
36414 }
36415
36416 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_minimum_msat"))) TS_AcceptChannelV2_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
36417         LDKAcceptChannelV2 this_ptr_conv;
36418         this_ptr_conv.inner = untag_ptr(this_ptr);
36419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36421         this_ptr_conv.is_owned = false;
36422         AcceptChannelV2_set_htlc_minimum_msat(&this_ptr_conv, val);
36423 }
36424
36425 int32_t  __attribute__((export_name("TS_AcceptChannelV2_get_minimum_depth"))) TS_AcceptChannelV2_get_minimum_depth(uint64_t this_ptr) {
36426         LDKAcceptChannelV2 this_ptr_conv;
36427         this_ptr_conv.inner = untag_ptr(this_ptr);
36428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36430         this_ptr_conv.is_owned = false;
36431         int32_t ret_conv = AcceptChannelV2_get_minimum_depth(&this_ptr_conv);
36432         return ret_conv;
36433 }
36434
36435 void  __attribute__((export_name("TS_AcceptChannelV2_set_minimum_depth"))) TS_AcceptChannelV2_set_minimum_depth(uint64_t this_ptr, int32_t val) {
36436         LDKAcceptChannelV2 this_ptr_conv;
36437         this_ptr_conv.inner = untag_ptr(this_ptr);
36438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36440         this_ptr_conv.is_owned = false;
36441         AcceptChannelV2_set_minimum_depth(&this_ptr_conv, val);
36442 }
36443
36444 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_to_self_delay"))) TS_AcceptChannelV2_get_to_self_delay(uint64_t this_ptr) {
36445         LDKAcceptChannelV2 this_ptr_conv;
36446         this_ptr_conv.inner = untag_ptr(this_ptr);
36447         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36448         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36449         this_ptr_conv.is_owned = false;
36450         int16_t ret_conv = AcceptChannelV2_get_to_self_delay(&this_ptr_conv);
36451         return ret_conv;
36452 }
36453
36454 void  __attribute__((export_name("TS_AcceptChannelV2_set_to_self_delay"))) TS_AcceptChannelV2_set_to_self_delay(uint64_t this_ptr, int16_t val) {
36455         LDKAcceptChannelV2 this_ptr_conv;
36456         this_ptr_conv.inner = untag_ptr(this_ptr);
36457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36459         this_ptr_conv.is_owned = false;
36460         AcceptChannelV2_set_to_self_delay(&this_ptr_conv, val);
36461 }
36462
36463 int16_t  __attribute__((export_name("TS_AcceptChannelV2_get_max_accepted_htlcs"))) TS_AcceptChannelV2_get_max_accepted_htlcs(uint64_t this_ptr) {
36464         LDKAcceptChannelV2 this_ptr_conv;
36465         this_ptr_conv.inner = untag_ptr(this_ptr);
36466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36468         this_ptr_conv.is_owned = false;
36469         int16_t ret_conv = AcceptChannelV2_get_max_accepted_htlcs(&this_ptr_conv);
36470         return ret_conv;
36471 }
36472
36473 void  __attribute__((export_name("TS_AcceptChannelV2_set_max_accepted_htlcs"))) TS_AcceptChannelV2_set_max_accepted_htlcs(uint64_t this_ptr, int16_t val) {
36474         LDKAcceptChannelV2 this_ptr_conv;
36475         this_ptr_conv.inner = untag_ptr(this_ptr);
36476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36478         this_ptr_conv.is_owned = false;
36479         AcceptChannelV2_set_max_accepted_htlcs(&this_ptr_conv, val);
36480 }
36481
36482 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_funding_pubkey"))) TS_AcceptChannelV2_get_funding_pubkey(uint64_t this_ptr) {
36483         LDKAcceptChannelV2 this_ptr_conv;
36484         this_ptr_conv.inner = untag_ptr(this_ptr);
36485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36487         this_ptr_conv.is_owned = false;
36488         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36489         memcpy(ret_arr->elems, AcceptChannelV2_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
36490         return ret_arr;
36491 }
36492
36493 void  __attribute__((export_name("TS_AcceptChannelV2_set_funding_pubkey"))) TS_AcceptChannelV2_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
36494         LDKAcceptChannelV2 this_ptr_conv;
36495         this_ptr_conv.inner = untag_ptr(this_ptr);
36496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36498         this_ptr_conv.is_owned = false;
36499         LDKPublicKey val_ref;
36500         CHECK(val->arr_len == 33);
36501         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36502         AcceptChannelV2_set_funding_pubkey(&this_ptr_conv, val_ref);
36503 }
36504
36505 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_revocation_basepoint"))) TS_AcceptChannelV2_get_revocation_basepoint(uint64_t this_ptr) {
36506         LDKAcceptChannelV2 this_ptr_conv;
36507         this_ptr_conv.inner = untag_ptr(this_ptr);
36508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36510         this_ptr_conv.is_owned = false;
36511         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36512         memcpy(ret_arr->elems, AcceptChannelV2_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
36513         return ret_arr;
36514 }
36515
36516 void  __attribute__((export_name("TS_AcceptChannelV2_set_revocation_basepoint"))) TS_AcceptChannelV2_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
36517         LDKAcceptChannelV2 this_ptr_conv;
36518         this_ptr_conv.inner = untag_ptr(this_ptr);
36519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36521         this_ptr_conv.is_owned = false;
36522         LDKPublicKey val_ref;
36523         CHECK(val->arr_len == 33);
36524         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36525         AcceptChannelV2_set_revocation_basepoint(&this_ptr_conv, val_ref);
36526 }
36527
36528 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_payment_basepoint"))) TS_AcceptChannelV2_get_payment_basepoint(uint64_t this_ptr) {
36529         LDKAcceptChannelV2 this_ptr_conv;
36530         this_ptr_conv.inner = untag_ptr(this_ptr);
36531         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36533         this_ptr_conv.is_owned = false;
36534         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36535         memcpy(ret_arr->elems, AcceptChannelV2_get_payment_basepoint(&this_ptr_conv).compressed_form, 33);
36536         return ret_arr;
36537 }
36538
36539 void  __attribute__((export_name("TS_AcceptChannelV2_set_payment_basepoint"))) TS_AcceptChannelV2_set_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
36540         LDKAcceptChannelV2 this_ptr_conv;
36541         this_ptr_conv.inner = untag_ptr(this_ptr);
36542         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36544         this_ptr_conv.is_owned = false;
36545         LDKPublicKey val_ref;
36546         CHECK(val->arr_len == 33);
36547         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36548         AcceptChannelV2_set_payment_basepoint(&this_ptr_conv, val_ref);
36549 }
36550
36551 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_delayed_payment_basepoint"))) TS_AcceptChannelV2_get_delayed_payment_basepoint(uint64_t this_ptr) {
36552         LDKAcceptChannelV2 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36558         memcpy(ret_arr->elems, AcceptChannelV2_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
36559         return ret_arr;
36560 }
36561
36562 void  __attribute__((export_name("TS_AcceptChannelV2_set_delayed_payment_basepoint"))) TS_AcceptChannelV2_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
36563         LDKAcceptChannelV2 this_ptr_conv;
36564         this_ptr_conv.inner = untag_ptr(this_ptr);
36565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36567         this_ptr_conv.is_owned = false;
36568         LDKPublicKey val_ref;
36569         CHECK(val->arr_len == 33);
36570         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36571         AcceptChannelV2_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
36572 }
36573
36574 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_htlc_basepoint"))) TS_AcceptChannelV2_get_htlc_basepoint(uint64_t this_ptr) {
36575         LDKAcceptChannelV2 this_ptr_conv;
36576         this_ptr_conv.inner = untag_ptr(this_ptr);
36577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36579         this_ptr_conv.is_owned = false;
36580         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36581         memcpy(ret_arr->elems, AcceptChannelV2_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
36582         return ret_arr;
36583 }
36584
36585 void  __attribute__((export_name("TS_AcceptChannelV2_set_htlc_basepoint"))) TS_AcceptChannelV2_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
36586         LDKAcceptChannelV2 this_ptr_conv;
36587         this_ptr_conv.inner = untag_ptr(this_ptr);
36588         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36590         this_ptr_conv.is_owned = false;
36591         LDKPublicKey val_ref;
36592         CHECK(val->arr_len == 33);
36593         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36594         AcceptChannelV2_set_htlc_basepoint(&this_ptr_conv, val_ref);
36595 }
36596
36597 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_first_per_commitment_point"))) TS_AcceptChannelV2_get_first_per_commitment_point(uint64_t this_ptr) {
36598         LDKAcceptChannelV2 this_ptr_conv;
36599         this_ptr_conv.inner = untag_ptr(this_ptr);
36600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36602         this_ptr_conv.is_owned = false;
36603         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36604         memcpy(ret_arr->elems, AcceptChannelV2_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33);
36605         return ret_arr;
36606 }
36607
36608 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) {
36609         LDKAcceptChannelV2 this_ptr_conv;
36610         this_ptr_conv.inner = untag_ptr(this_ptr);
36611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36613         this_ptr_conv.is_owned = false;
36614         LDKPublicKey val_ref;
36615         CHECK(val->arr_len == 33);
36616         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36617         AcceptChannelV2_set_first_per_commitment_point(&this_ptr_conv, val_ref);
36618 }
36619
36620 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_get_second_per_commitment_point"))) TS_AcceptChannelV2_get_second_per_commitment_point(uint64_t this_ptr) {
36621         LDKAcceptChannelV2 this_ptr_conv;
36622         this_ptr_conv.inner = untag_ptr(this_ptr);
36623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36625         this_ptr_conv.is_owned = false;
36626         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
36627         memcpy(ret_arr->elems, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form, 33);
36628         return ret_arr;
36629 }
36630
36631 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) {
36632         LDKAcceptChannelV2 this_ptr_conv;
36633         this_ptr_conv.inner = untag_ptr(this_ptr);
36634         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36636         this_ptr_conv.is_owned = false;
36637         LDKPublicKey val_ref;
36638         CHECK(val->arr_len == 33);
36639         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
36640         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
36641 }
36642
36643 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_shutdown_scriptpubkey"))) TS_AcceptChannelV2_get_shutdown_scriptpubkey(uint64_t this_ptr) {
36644         LDKAcceptChannelV2 this_ptr_conv;
36645         this_ptr_conv.inner = untag_ptr(this_ptr);
36646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36648         this_ptr_conv.is_owned = false;
36649         LDKCOption_ScriptZ *ret_copy = MALLOC(sizeof(LDKCOption_ScriptZ), "LDKCOption_ScriptZ");
36650         *ret_copy = AcceptChannelV2_get_shutdown_scriptpubkey(&this_ptr_conv);
36651         uint64_t ret_ref = tag_ptr(ret_copy, true);
36652         return ret_ref;
36653 }
36654
36655 void  __attribute__((export_name("TS_AcceptChannelV2_set_shutdown_scriptpubkey"))) TS_AcceptChannelV2_set_shutdown_scriptpubkey(uint64_t this_ptr, uint64_t val) {
36656         LDKAcceptChannelV2 this_ptr_conv;
36657         this_ptr_conv.inner = untag_ptr(this_ptr);
36658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36660         this_ptr_conv.is_owned = false;
36661         void* val_ptr = untag_ptr(val);
36662         CHECK_ACCESS(val_ptr);
36663         LDKCOption_ScriptZ val_conv = *(LDKCOption_ScriptZ*)(val_ptr);
36664         val_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(val));
36665         AcceptChannelV2_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
36666 }
36667
36668 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_get_channel_type"))) TS_AcceptChannelV2_get_channel_type(uint64_t this_ptr) {
36669         LDKAcceptChannelV2 this_ptr_conv;
36670         this_ptr_conv.inner = untag_ptr(this_ptr);
36671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36673         this_ptr_conv.is_owned = false;
36674         LDKChannelTypeFeatures ret_var = AcceptChannelV2_get_channel_type(&this_ptr_conv);
36675         uint64_t ret_ref = 0;
36676         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36677         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36678         return ret_ref;
36679 }
36680
36681 void  __attribute__((export_name("TS_AcceptChannelV2_set_channel_type"))) TS_AcceptChannelV2_set_channel_type(uint64_t this_ptr, uint64_t val) {
36682         LDKAcceptChannelV2 this_ptr_conv;
36683         this_ptr_conv.inner = untag_ptr(this_ptr);
36684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36686         this_ptr_conv.is_owned = false;
36687         LDKChannelTypeFeatures val_conv;
36688         val_conv.inner = untag_ptr(val);
36689         val_conv.is_owned = ptr_is_owned(val);
36690         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
36691         val_conv = ChannelTypeFeatures_clone(&val_conv);
36692         AcceptChannelV2_set_channel_type(&this_ptr_conv, val_conv);
36693 }
36694
36695 uint32_t  __attribute__((export_name("TS_AcceptChannelV2_get_require_confirmed_inputs"))) TS_AcceptChannelV2_get_require_confirmed_inputs(uint64_t this_ptr) {
36696         LDKAcceptChannelV2 this_ptr_conv;
36697         this_ptr_conv.inner = untag_ptr(this_ptr);
36698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36700         this_ptr_conv.is_owned = false;
36701         uint32_t ret_conv = LDKCOption_NoneZ_to_js(AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
36702         return ret_conv;
36703 }
36704
36705 void  __attribute__((export_name("TS_AcceptChannelV2_set_require_confirmed_inputs"))) TS_AcceptChannelV2_set_require_confirmed_inputs(uint64_t this_ptr, uint32_t val) {
36706         LDKAcceptChannelV2 this_ptr_conv;
36707         this_ptr_conv.inner = untag_ptr(this_ptr);
36708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36710         this_ptr_conv.is_owned = false;
36711         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val);
36712         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
36713 }
36714
36715 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) {
36716         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
36717         CHECK(temporary_channel_id_arg->arr_len == 32);
36718         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
36719         LDKPublicKey funding_pubkey_arg_ref;
36720         CHECK(funding_pubkey_arg->arr_len == 33);
36721         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
36722         LDKPublicKey revocation_basepoint_arg_ref;
36723         CHECK(revocation_basepoint_arg->arr_len == 33);
36724         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
36725         LDKPublicKey payment_basepoint_arg_ref;
36726         CHECK(payment_basepoint_arg->arr_len == 33);
36727         memcpy(payment_basepoint_arg_ref.compressed_form, payment_basepoint_arg->elems, 33); FREE(payment_basepoint_arg);
36728         LDKPublicKey delayed_payment_basepoint_arg_ref;
36729         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
36730         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
36731         LDKPublicKey htlc_basepoint_arg_ref;
36732         CHECK(htlc_basepoint_arg->arr_len == 33);
36733         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
36734         LDKPublicKey first_per_commitment_point_arg_ref;
36735         CHECK(first_per_commitment_point_arg->arr_len == 33);
36736         memcpy(first_per_commitment_point_arg_ref.compressed_form, first_per_commitment_point_arg->elems, 33); FREE(first_per_commitment_point_arg);
36737         LDKPublicKey second_per_commitment_point_arg_ref;
36738         CHECK(second_per_commitment_point_arg->arr_len == 33);
36739         memcpy(second_per_commitment_point_arg_ref.compressed_form, second_per_commitment_point_arg->elems, 33); FREE(second_per_commitment_point_arg);
36740         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
36741         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
36742         LDKCOption_ScriptZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_ScriptZ*)(shutdown_scriptpubkey_arg_ptr);
36743         shutdown_scriptpubkey_arg_conv = COption_ScriptZ_clone((LDKCOption_ScriptZ*)untag_ptr(shutdown_scriptpubkey_arg));
36744         LDKChannelTypeFeatures channel_type_arg_conv;
36745         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
36746         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
36747         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
36748         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
36749         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_js(require_confirmed_inputs_arg);
36750         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);
36751         uint64_t ret_ref = 0;
36752         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36753         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36754         return ret_ref;
36755 }
36756
36757 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
36758         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
36759         uint64_t ret_ref = 0;
36760         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36761         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36762         return ret_ref;
36763 }
36764 int64_t  __attribute__((export_name("TS_AcceptChannelV2_clone_ptr"))) TS_AcceptChannelV2_clone_ptr(uint64_t arg) {
36765         LDKAcceptChannelV2 arg_conv;
36766         arg_conv.inner = untag_ptr(arg);
36767         arg_conv.is_owned = ptr_is_owned(arg);
36768         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36769         arg_conv.is_owned = false;
36770         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
36771         return ret_conv;
36772 }
36773
36774 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_clone"))) TS_AcceptChannelV2_clone(uint64_t orig) {
36775         LDKAcceptChannelV2 orig_conv;
36776         orig_conv.inner = untag_ptr(orig);
36777         orig_conv.is_owned = ptr_is_owned(orig);
36778         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36779         orig_conv.is_owned = false;
36780         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
36781         uint64_t ret_ref = 0;
36782         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36783         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36784         return ret_ref;
36785 }
36786
36787 jboolean  __attribute__((export_name("TS_AcceptChannelV2_eq"))) TS_AcceptChannelV2_eq(uint64_t a, uint64_t b) {
36788         LDKAcceptChannelV2 a_conv;
36789         a_conv.inner = untag_ptr(a);
36790         a_conv.is_owned = ptr_is_owned(a);
36791         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36792         a_conv.is_owned = false;
36793         LDKAcceptChannelV2 b_conv;
36794         b_conv.inner = untag_ptr(b);
36795         b_conv.is_owned = ptr_is_owned(b);
36796         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36797         b_conv.is_owned = false;
36798         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
36799         return ret_conv;
36800 }
36801
36802 void  __attribute__((export_name("TS_FundingCreated_free"))) TS_FundingCreated_free(uint64_t this_obj) {
36803         LDKFundingCreated this_obj_conv;
36804         this_obj_conv.inner = untag_ptr(this_obj);
36805         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36807         FundingCreated_free(this_obj_conv);
36808 }
36809
36810 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_temporary_channel_id"))) TS_FundingCreated_get_temporary_channel_id(uint64_t this_ptr) {
36811         LDKFundingCreated this_ptr_conv;
36812         this_ptr_conv.inner = untag_ptr(this_ptr);
36813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36815         this_ptr_conv.is_owned = false;
36816         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36817         memcpy(ret_arr->elems, *FundingCreated_get_temporary_channel_id(&this_ptr_conv), 32);
36818         return ret_arr;
36819 }
36820
36821 void  __attribute__((export_name("TS_FundingCreated_set_temporary_channel_id"))) TS_FundingCreated_set_temporary_channel_id(uint64_t this_ptr, int8_tArray val) {
36822         LDKFundingCreated this_ptr_conv;
36823         this_ptr_conv.inner = untag_ptr(this_ptr);
36824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36826         this_ptr_conv.is_owned = false;
36827         LDKThirtyTwoBytes val_ref;
36828         CHECK(val->arr_len == 32);
36829         memcpy(val_ref.data, val->elems, 32); FREE(val);
36830         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
36831 }
36832
36833 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_funding_txid"))) TS_FundingCreated_get_funding_txid(uint64_t this_ptr) {
36834         LDKFundingCreated this_ptr_conv;
36835         this_ptr_conv.inner = untag_ptr(this_ptr);
36836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36838         this_ptr_conv.is_owned = false;
36839         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36840         memcpy(ret_arr->elems, *FundingCreated_get_funding_txid(&this_ptr_conv), 32);
36841         return ret_arr;
36842 }
36843
36844 void  __attribute__((export_name("TS_FundingCreated_set_funding_txid"))) TS_FundingCreated_set_funding_txid(uint64_t this_ptr, int8_tArray val) {
36845         LDKFundingCreated this_ptr_conv;
36846         this_ptr_conv.inner = untag_ptr(this_ptr);
36847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36849         this_ptr_conv.is_owned = false;
36850         LDKThirtyTwoBytes val_ref;
36851         CHECK(val->arr_len == 32);
36852         memcpy(val_ref.data, val->elems, 32); FREE(val);
36853         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
36854 }
36855
36856 int16_t  __attribute__((export_name("TS_FundingCreated_get_funding_output_index"))) TS_FundingCreated_get_funding_output_index(uint64_t this_ptr) {
36857         LDKFundingCreated this_ptr_conv;
36858         this_ptr_conv.inner = untag_ptr(this_ptr);
36859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36861         this_ptr_conv.is_owned = false;
36862         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
36863         return ret_conv;
36864 }
36865
36866 void  __attribute__((export_name("TS_FundingCreated_set_funding_output_index"))) TS_FundingCreated_set_funding_output_index(uint64_t this_ptr, int16_t val) {
36867         LDKFundingCreated this_ptr_conv;
36868         this_ptr_conv.inner = untag_ptr(this_ptr);
36869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36871         this_ptr_conv.is_owned = false;
36872         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
36873 }
36874
36875 int8_tArray  __attribute__((export_name("TS_FundingCreated_get_signature"))) TS_FundingCreated_get_signature(uint64_t this_ptr) {
36876         LDKFundingCreated 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         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36882         memcpy(ret_arr->elems, FundingCreated_get_signature(&this_ptr_conv).compact_form, 64);
36883         return ret_arr;
36884 }
36885
36886 void  __attribute__((export_name("TS_FundingCreated_set_signature"))) TS_FundingCreated_set_signature(uint64_t this_ptr, int8_tArray val) {
36887         LDKFundingCreated this_ptr_conv;
36888         this_ptr_conv.inner = untag_ptr(this_ptr);
36889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36891         this_ptr_conv.is_owned = false;
36892         LDKSignature val_ref;
36893         CHECK(val->arr_len == 64);
36894         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
36895         FundingCreated_set_signature(&this_ptr_conv, val_ref);
36896 }
36897
36898 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) {
36899         LDKThirtyTwoBytes temporary_channel_id_arg_ref;
36900         CHECK(temporary_channel_id_arg->arr_len == 32);
36901         memcpy(temporary_channel_id_arg_ref.data, temporary_channel_id_arg->elems, 32); FREE(temporary_channel_id_arg);
36902         LDKThirtyTwoBytes funding_txid_arg_ref;
36903         CHECK(funding_txid_arg->arr_len == 32);
36904         memcpy(funding_txid_arg_ref.data, funding_txid_arg->elems, 32); FREE(funding_txid_arg);
36905         LDKSignature signature_arg_ref;
36906         CHECK(signature_arg->arr_len == 64);
36907         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
36908         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
36909         uint64_t ret_ref = 0;
36910         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36911         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36912         return ret_ref;
36913 }
36914
36915 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
36916         LDKFundingCreated ret_var = FundingCreated_clone(arg);
36917         uint64_t ret_ref = 0;
36918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36920         return ret_ref;
36921 }
36922 int64_t  __attribute__((export_name("TS_FundingCreated_clone_ptr"))) TS_FundingCreated_clone_ptr(uint64_t arg) {
36923         LDKFundingCreated arg_conv;
36924         arg_conv.inner = untag_ptr(arg);
36925         arg_conv.is_owned = ptr_is_owned(arg);
36926         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
36927         arg_conv.is_owned = false;
36928         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
36929         return ret_conv;
36930 }
36931
36932 uint64_t  __attribute__((export_name("TS_FundingCreated_clone"))) TS_FundingCreated_clone(uint64_t orig) {
36933         LDKFundingCreated orig_conv;
36934         orig_conv.inner = untag_ptr(orig);
36935         orig_conv.is_owned = ptr_is_owned(orig);
36936         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
36937         orig_conv.is_owned = false;
36938         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
36939         uint64_t ret_ref = 0;
36940         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
36941         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
36942         return ret_ref;
36943 }
36944
36945 jboolean  __attribute__((export_name("TS_FundingCreated_eq"))) TS_FundingCreated_eq(uint64_t a, uint64_t b) {
36946         LDKFundingCreated a_conv;
36947         a_conv.inner = untag_ptr(a);
36948         a_conv.is_owned = ptr_is_owned(a);
36949         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
36950         a_conv.is_owned = false;
36951         LDKFundingCreated b_conv;
36952         b_conv.inner = untag_ptr(b);
36953         b_conv.is_owned = ptr_is_owned(b);
36954         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
36955         b_conv.is_owned = false;
36956         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
36957         return ret_conv;
36958 }
36959
36960 void  __attribute__((export_name("TS_FundingSigned_free"))) TS_FundingSigned_free(uint64_t this_obj) {
36961         LDKFundingSigned this_obj_conv;
36962         this_obj_conv.inner = untag_ptr(this_obj);
36963         this_obj_conv.is_owned = ptr_is_owned(this_obj);
36964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
36965         FundingSigned_free(this_obj_conv);
36966 }
36967
36968 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_channel_id"))) TS_FundingSigned_get_channel_id(uint64_t this_ptr) {
36969         LDKFundingSigned this_ptr_conv;
36970         this_ptr_conv.inner = untag_ptr(this_ptr);
36971         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36973         this_ptr_conv.is_owned = false;
36974         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
36975         memcpy(ret_arr->elems, *FundingSigned_get_channel_id(&this_ptr_conv), 32);
36976         return ret_arr;
36977 }
36978
36979 void  __attribute__((export_name("TS_FundingSigned_set_channel_id"))) TS_FundingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
36980         LDKFundingSigned this_ptr_conv;
36981         this_ptr_conv.inner = untag_ptr(this_ptr);
36982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36984         this_ptr_conv.is_owned = false;
36985         LDKThirtyTwoBytes val_ref;
36986         CHECK(val->arr_len == 32);
36987         memcpy(val_ref.data, val->elems, 32); FREE(val);
36988         FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
36989 }
36990
36991 int8_tArray  __attribute__((export_name("TS_FundingSigned_get_signature"))) TS_FundingSigned_get_signature(uint64_t this_ptr) {
36992         LDKFundingSigned this_ptr_conv;
36993         this_ptr_conv.inner = untag_ptr(this_ptr);
36994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
36995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
36996         this_ptr_conv.is_owned = false;
36997         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
36998         memcpy(ret_arr->elems, FundingSigned_get_signature(&this_ptr_conv).compact_form, 64);
36999         return ret_arr;
37000 }
37001
37002 void  __attribute__((export_name("TS_FundingSigned_set_signature"))) TS_FundingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
37003         LDKFundingSigned this_ptr_conv;
37004         this_ptr_conv.inner = untag_ptr(this_ptr);
37005         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37007         this_ptr_conv.is_owned = false;
37008         LDKSignature val_ref;
37009         CHECK(val->arr_len == 64);
37010         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
37011         FundingSigned_set_signature(&this_ptr_conv, val_ref);
37012 }
37013
37014 uint64_t  __attribute__((export_name("TS_FundingSigned_new"))) TS_FundingSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg) {
37015         LDKThirtyTwoBytes channel_id_arg_ref;
37016         CHECK(channel_id_arg->arr_len == 32);
37017         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37018         LDKSignature signature_arg_ref;
37019         CHECK(signature_arg->arr_len == 64);
37020         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
37021         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
37022         uint64_t ret_ref = 0;
37023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37025         return ret_ref;
37026 }
37027
37028 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
37029         LDKFundingSigned ret_var = FundingSigned_clone(arg);
37030         uint64_t ret_ref = 0;
37031         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37032         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37033         return ret_ref;
37034 }
37035 int64_t  __attribute__((export_name("TS_FundingSigned_clone_ptr"))) TS_FundingSigned_clone_ptr(uint64_t arg) {
37036         LDKFundingSigned arg_conv;
37037         arg_conv.inner = untag_ptr(arg);
37038         arg_conv.is_owned = ptr_is_owned(arg);
37039         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37040         arg_conv.is_owned = false;
37041         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
37042         return ret_conv;
37043 }
37044
37045 uint64_t  __attribute__((export_name("TS_FundingSigned_clone"))) TS_FundingSigned_clone(uint64_t orig) {
37046         LDKFundingSigned orig_conv;
37047         orig_conv.inner = untag_ptr(orig);
37048         orig_conv.is_owned = ptr_is_owned(orig);
37049         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37050         orig_conv.is_owned = false;
37051         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
37052         uint64_t ret_ref = 0;
37053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37055         return ret_ref;
37056 }
37057
37058 jboolean  __attribute__((export_name("TS_FundingSigned_eq"))) TS_FundingSigned_eq(uint64_t a, uint64_t b) {
37059         LDKFundingSigned a_conv;
37060         a_conv.inner = untag_ptr(a);
37061         a_conv.is_owned = ptr_is_owned(a);
37062         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37063         a_conv.is_owned = false;
37064         LDKFundingSigned b_conv;
37065         b_conv.inner = untag_ptr(b);
37066         b_conv.is_owned = ptr_is_owned(b);
37067         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37068         b_conv.is_owned = false;
37069         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
37070         return ret_conv;
37071 }
37072
37073 void  __attribute__((export_name("TS_ChannelReady_free"))) TS_ChannelReady_free(uint64_t this_obj) {
37074         LDKChannelReady this_obj_conv;
37075         this_obj_conv.inner = untag_ptr(this_obj);
37076         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37078         ChannelReady_free(this_obj_conv);
37079 }
37080
37081 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_channel_id"))) TS_ChannelReady_get_channel_id(uint64_t this_ptr) {
37082         LDKChannelReady this_ptr_conv;
37083         this_ptr_conv.inner = untag_ptr(this_ptr);
37084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37086         this_ptr_conv.is_owned = false;
37087         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37088         memcpy(ret_arr->elems, *ChannelReady_get_channel_id(&this_ptr_conv), 32);
37089         return ret_arr;
37090 }
37091
37092 void  __attribute__((export_name("TS_ChannelReady_set_channel_id"))) TS_ChannelReady_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37093         LDKChannelReady 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         LDKThirtyTwoBytes val_ref;
37099         CHECK(val->arr_len == 32);
37100         memcpy(val_ref.data, val->elems, 32); FREE(val);
37101         ChannelReady_set_channel_id(&this_ptr_conv, val_ref);
37102 }
37103
37104 int8_tArray  __attribute__((export_name("TS_ChannelReady_get_next_per_commitment_point"))) TS_ChannelReady_get_next_per_commitment_point(uint64_t this_ptr) {
37105         LDKChannelReady this_ptr_conv;
37106         this_ptr_conv.inner = untag_ptr(this_ptr);
37107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37109         this_ptr_conv.is_owned = false;
37110         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
37111         memcpy(ret_arr->elems, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
37112         return ret_arr;
37113 }
37114
37115 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) {
37116         LDKChannelReady 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         LDKPublicKey val_ref;
37122         CHECK(val->arr_len == 33);
37123         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
37124         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
37125 }
37126
37127 uint64_t  __attribute__((export_name("TS_ChannelReady_get_short_channel_id_alias"))) TS_ChannelReady_get_short_channel_id_alias(uint64_t this_ptr) {
37128         LDKChannelReady this_ptr_conv;
37129         this_ptr_conv.inner = untag_ptr(this_ptr);
37130         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37132         this_ptr_conv.is_owned = false;
37133         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
37134         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
37135         uint64_t ret_ref = tag_ptr(ret_copy, true);
37136         return ret_ref;
37137 }
37138
37139 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) {
37140         LDKChannelReady this_ptr_conv;
37141         this_ptr_conv.inner = untag_ptr(this_ptr);
37142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37144         this_ptr_conv.is_owned = false;
37145         void* val_ptr = untag_ptr(val);
37146         CHECK_ACCESS(val_ptr);
37147         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
37148         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
37149         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
37150 }
37151
37152 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) {
37153         LDKThirtyTwoBytes channel_id_arg_ref;
37154         CHECK(channel_id_arg->arr_len == 32);
37155         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37156         LDKPublicKey next_per_commitment_point_arg_ref;
37157         CHECK(next_per_commitment_point_arg->arr_len == 33);
37158         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
37159         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
37160         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
37161         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
37162         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
37163         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
37164         uint64_t ret_ref = 0;
37165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37167         return ret_ref;
37168 }
37169
37170 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
37171         LDKChannelReady ret_var = ChannelReady_clone(arg);
37172         uint64_t ret_ref = 0;
37173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37175         return ret_ref;
37176 }
37177 int64_t  __attribute__((export_name("TS_ChannelReady_clone_ptr"))) TS_ChannelReady_clone_ptr(uint64_t arg) {
37178         LDKChannelReady arg_conv;
37179         arg_conv.inner = untag_ptr(arg);
37180         arg_conv.is_owned = ptr_is_owned(arg);
37181         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37182         arg_conv.is_owned = false;
37183         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
37184         return ret_conv;
37185 }
37186
37187 uint64_t  __attribute__((export_name("TS_ChannelReady_clone"))) TS_ChannelReady_clone(uint64_t orig) {
37188         LDKChannelReady orig_conv;
37189         orig_conv.inner = untag_ptr(orig);
37190         orig_conv.is_owned = ptr_is_owned(orig);
37191         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37192         orig_conv.is_owned = false;
37193         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
37194         uint64_t ret_ref = 0;
37195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37197         return ret_ref;
37198 }
37199
37200 jboolean  __attribute__((export_name("TS_ChannelReady_eq"))) TS_ChannelReady_eq(uint64_t a, uint64_t b) {
37201         LDKChannelReady a_conv;
37202         a_conv.inner = untag_ptr(a);
37203         a_conv.is_owned = ptr_is_owned(a);
37204         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37205         a_conv.is_owned = false;
37206         LDKChannelReady b_conv;
37207         b_conv.inner = untag_ptr(b);
37208         b_conv.is_owned = ptr_is_owned(b);
37209         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37210         b_conv.is_owned = false;
37211         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
37212         return ret_conv;
37213 }
37214
37215 void  __attribute__((export_name("TS_TxAddInput_free"))) TS_TxAddInput_free(uint64_t this_obj) {
37216         LDKTxAddInput this_obj_conv;
37217         this_obj_conv.inner = untag_ptr(this_obj);
37218         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37220         TxAddInput_free(this_obj_conv);
37221 }
37222
37223 int8_tArray  __attribute__((export_name("TS_TxAddInput_get_channel_id"))) TS_TxAddInput_get_channel_id(uint64_t this_ptr) {
37224         LDKTxAddInput this_ptr_conv;
37225         this_ptr_conv.inner = untag_ptr(this_ptr);
37226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37228         this_ptr_conv.is_owned = false;
37229         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37230         memcpy(ret_arr->elems, *TxAddInput_get_channel_id(&this_ptr_conv), 32);
37231         return ret_arr;
37232 }
37233
37234 void  __attribute__((export_name("TS_TxAddInput_set_channel_id"))) TS_TxAddInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37235         LDKTxAddInput this_ptr_conv;
37236         this_ptr_conv.inner = untag_ptr(this_ptr);
37237         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37238         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37239         this_ptr_conv.is_owned = false;
37240         LDKThirtyTwoBytes val_ref;
37241         CHECK(val->arr_len == 32);
37242         memcpy(val_ref.data, val->elems, 32); FREE(val);
37243         TxAddInput_set_channel_id(&this_ptr_conv, val_ref);
37244 }
37245
37246 int64_t  __attribute__((export_name("TS_TxAddInput_get_serial_id"))) TS_TxAddInput_get_serial_id(uint64_t this_ptr) {
37247         LDKTxAddInput this_ptr_conv;
37248         this_ptr_conv.inner = untag_ptr(this_ptr);
37249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37251         this_ptr_conv.is_owned = false;
37252         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
37253         return ret_conv;
37254 }
37255
37256 void  __attribute__((export_name("TS_TxAddInput_set_serial_id"))) TS_TxAddInput_set_serial_id(uint64_t this_ptr, int64_t val) {
37257         LDKTxAddInput this_ptr_conv;
37258         this_ptr_conv.inner = untag_ptr(this_ptr);
37259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37261         this_ptr_conv.is_owned = false;
37262         TxAddInput_set_serial_id(&this_ptr_conv, val);
37263 }
37264
37265 uint64_t  __attribute__((export_name("TS_TxAddInput_get_prevtx"))) TS_TxAddInput_get_prevtx(uint64_t this_ptr) {
37266         LDKTxAddInput this_ptr_conv;
37267         this_ptr_conv.inner = untag_ptr(this_ptr);
37268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37270         this_ptr_conv.is_owned = false;
37271         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
37272         uint64_t ret_ref = 0;
37273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37275         return ret_ref;
37276 }
37277
37278 void  __attribute__((export_name("TS_TxAddInput_set_prevtx"))) TS_TxAddInput_set_prevtx(uint64_t this_ptr, uint64_t val) {
37279         LDKTxAddInput this_ptr_conv;
37280         this_ptr_conv.inner = untag_ptr(this_ptr);
37281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37283         this_ptr_conv.is_owned = false;
37284         LDKTransactionU16LenLimited val_conv;
37285         val_conv.inner = untag_ptr(val);
37286         val_conv.is_owned = ptr_is_owned(val);
37287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
37288         val_conv = TransactionU16LenLimited_clone(&val_conv);
37289         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
37290 }
37291
37292 int32_t  __attribute__((export_name("TS_TxAddInput_get_prevtx_out"))) TS_TxAddInput_get_prevtx_out(uint64_t this_ptr) {
37293         LDKTxAddInput this_ptr_conv;
37294         this_ptr_conv.inner = untag_ptr(this_ptr);
37295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37297         this_ptr_conv.is_owned = false;
37298         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
37299         return ret_conv;
37300 }
37301
37302 void  __attribute__((export_name("TS_TxAddInput_set_prevtx_out"))) TS_TxAddInput_set_prevtx_out(uint64_t this_ptr, int32_t val) {
37303         LDKTxAddInput this_ptr_conv;
37304         this_ptr_conv.inner = untag_ptr(this_ptr);
37305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37307         this_ptr_conv.is_owned = false;
37308         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
37309 }
37310
37311 int32_t  __attribute__((export_name("TS_TxAddInput_get_sequence"))) TS_TxAddInput_get_sequence(uint64_t this_ptr) {
37312         LDKTxAddInput this_ptr_conv;
37313         this_ptr_conv.inner = untag_ptr(this_ptr);
37314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37316         this_ptr_conv.is_owned = false;
37317         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
37318         return ret_conv;
37319 }
37320
37321 void  __attribute__((export_name("TS_TxAddInput_set_sequence"))) TS_TxAddInput_set_sequence(uint64_t this_ptr, int32_t val) {
37322         LDKTxAddInput this_ptr_conv;
37323         this_ptr_conv.inner = untag_ptr(this_ptr);
37324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37326         this_ptr_conv.is_owned = false;
37327         TxAddInput_set_sequence(&this_ptr_conv, val);
37328 }
37329
37330 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) {
37331         LDKThirtyTwoBytes channel_id_arg_ref;
37332         CHECK(channel_id_arg->arr_len == 32);
37333         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37334         LDKTransactionU16LenLimited prevtx_arg_conv;
37335         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
37336         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
37337         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
37338         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
37339         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_ref, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
37340         uint64_t ret_ref = 0;
37341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37343         return ret_ref;
37344 }
37345
37346 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
37347         LDKTxAddInput ret_var = TxAddInput_clone(arg);
37348         uint64_t ret_ref = 0;
37349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37351         return ret_ref;
37352 }
37353 int64_t  __attribute__((export_name("TS_TxAddInput_clone_ptr"))) TS_TxAddInput_clone_ptr(uint64_t arg) {
37354         LDKTxAddInput arg_conv;
37355         arg_conv.inner = untag_ptr(arg);
37356         arg_conv.is_owned = ptr_is_owned(arg);
37357         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37358         arg_conv.is_owned = false;
37359         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
37360         return ret_conv;
37361 }
37362
37363 uint64_t  __attribute__((export_name("TS_TxAddInput_clone"))) TS_TxAddInput_clone(uint64_t orig) {
37364         LDKTxAddInput orig_conv;
37365         orig_conv.inner = untag_ptr(orig);
37366         orig_conv.is_owned = ptr_is_owned(orig);
37367         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37368         orig_conv.is_owned = false;
37369         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
37370         uint64_t ret_ref = 0;
37371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37373         return ret_ref;
37374 }
37375
37376 jboolean  __attribute__((export_name("TS_TxAddInput_eq"))) TS_TxAddInput_eq(uint64_t a, uint64_t b) {
37377         LDKTxAddInput a_conv;
37378         a_conv.inner = untag_ptr(a);
37379         a_conv.is_owned = ptr_is_owned(a);
37380         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37381         a_conv.is_owned = false;
37382         LDKTxAddInput b_conv;
37383         b_conv.inner = untag_ptr(b);
37384         b_conv.is_owned = ptr_is_owned(b);
37385         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37386         b_conv.is_owned = false;
37387         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
37388         return ret_conv;
37389 }
37390
37391 void  __attribute__((export_name("TS_TxAddOutput_free"))) TS_TxAddOutput_free(uint64_t this_obj) {
37392         LDKTxAddOutput this_obj_conv;
37393         this_obj_conv.inner = untag_ptr(this_obj);
37394         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37396         TxAddOutput_free(this_obj_conv);
37397 }
37398
37399 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_channel_id"))) TS_TxAddOutput_get_channel_id(uint64_t this_ptr) {
37400         LDKTxAddOutput this_ptr_conv;
37401         this_ptr_conv.inner = untag_ptr(this_ptr);
37402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37404         this_ptr_conv.is_owned = false;
37405         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37406         memcpy(ret_arr->elems, *TxAddOutput_get_channel_id(&this_ptr_conv), 32);
37407         return ret_arr;
37408 }
37409
37410 void  __attribute__((export_name("TS_TxAddOutput_set_channel_id"))) TS_TxAddOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37411         LDKTxAddOutput this_ptr_conv;
37412         this_ptr_conv.inner = untag_ptr(this_ptr);
37413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37415         this_ptr_conv.is_owned = false;
37416         LDKThirtyTwoBytes val_ref;
37417         CHECK(val->arr_len == 32);
37418         memcpy(val_ref.data, val->elems, 32); FREE(val);
37419         TxAddOutput_set_channel_id(&this_ptr_conv, val_ref);
37420 }
37421
37422 int64_t  __attribute__((export_name("TS_TxAddOutput_get_serial_id"))) TS_TxAddOutput_get_serial_id(uint64_t this_ptr) {
37423         LDKTxAddOutput this_ptr_conv;
37424         this_ptr_conv.inner = untag_ptr(this_ptr);
37425         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37427         this_ptr_conv.is_owned = false;
37428         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
37429         return ret_conv;
37430 }
37431
37432 void  __attribute__((export_name("TS_TxAddOutput_set_serial_id"))) TS_TxAddOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
37433         LDKTxAddOutput this_ptr_conv;
37434         this_ptr_conv.inner = untag_ptr(this_ptr);
37435         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37437         this_ptr_conv.is_owned = false;
37438         TxAddOutput_set_serial_id(&this_ptr_conv, val);
37439 }
37440
37441 int64_t  __attribute__((export_name("TS_TxAddOutput_get_sats"))) TS_TxAddOutput_get_sats(uint64_t this_ptr) {
37442         LDKTxAddOutput this_ptr_conv;
37443         this_ptr_conv.inner = untag_ptr(this_ptr);
37444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37446         this_ptr_conv.is_owned = false;
37447         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
37448         return ret_conv;
37449 }
37450
37451 void  __attribute__((export_name("TS_TxAddOutput_set_sats"))) TS_TxAddOutput_set_sats(uint64_t this_ptr, int64_t val) {
37452         LDKTxAddOutput this_ptr_conv;
37453         this_ptr_conv.inner = untag_ptr(this_ptr);
37454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37456         this_ptr_conv.is_owned = false;
37457         TxAddOutput_set_sats(&this_ptr_conv, val);
37458 }
37459
37460 int8_tArray  __attribute__((export_name("TS_TxAddOutput_get_script"))) TS_TxAddOutput_get_script(uint64_t this_ptr) {
37461         LDKTxAddOutput this_ptr_conv;
37462         this_ptr_conv.inner = untag_ptr(this_ptr);
37463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37465         this_ptr_conv.is_owned = false;
37466         LDKu8slice ret_var = TxAddOutput_get_script(&this_ptr_conv);
37467         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
37468         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
37469         return ret_arr;
37470 }
37471
37472 void  __attribute__((export_name("TS_TxAddOutput_set_script"))) TS_TxAddOutput_set_script(uint64_t this_ptr, int8_tArray val) {
37473         LDKTxAddOutput this_ptr_conv;
37474         this_ptr_conv.inner = untag_ptr(this_ptr);
37475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37477         this_ptr_conv.is_owned = false;
37478         LDKCVec_u8Z val_ref;
37479         val_ref.datalen = val->arr_len;
37480         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
37481         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
37482         TxAddOutput_set_script(&this_ptr_conv, val_ref);
37483 }
37484
37485 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) {
37486         LDKThirtyTwoBytes channel_id_arg_ref;
37487         CHECK(channel_id_arg->arr_len == 32);
37488         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37489         LDKCVec_u8Z script_arg_ref;
37490         script_arg_ref.datalen = script_arg->arr_len;
37491         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
37492         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
37493         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_ref, serial_id_arg, sats_arg, script_arg_ref);
37494         uint64_t ret_ref = 0;
37495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37497         return ret_ref;
37498 }
37499
37500 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
37501         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
37502         uint64_t ret_ref = 0;
37503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37505         return ret_ref;
37506 }
37507 int64_t  __attribute__((export_name("TS_TxAddOutput_clone_ptr"))) TS_TxAddOutput_clone_ptr(uint64_t arg) {
37508         LDKTxAddOutput arg_conv;
37509         arg_conv.inner = untag_ptr(arg);
37510         arg_conv.is_owned = ptr_is_owned(arg);
37511         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37512         arg_conv.is_owned = false;
37513         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
37514         return ret_conv;
37515 }
37516
37517 uint64_t  __attribute__((export_name("TS_TxAddOutput_clone"))) TS_TxAddOutput_clone(uint64_t orig) {
37518         LDKTxAddOutput orig_conv;
37519         orig_conv.inner = untag_ptr(orig);
37520         orig_conv.is_owned = ptr_is_owned(orig);
37521         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37522         orig_conv.is_owned = false;
37523         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
37524         uint64_t ret_ref = 0;
37525         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37526         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37527         return ret_ref;
37528 }
37529
37530 jboolean  __attribute__((export_name("TS_TxAddOutput_eq"))) TS_TxAddOutput_eq(uint64_t a, uint64_t b) {
37531         LDKTxAddOutput a_conv;
37532         a_conv.inner = untag_ptr(a);
37533         a_conv.is_owned = ptr_is_owned(a);
37534         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37535         a_conv.is_owned = false;
37536         LDKTxAddOutput b_conv;
37537         b_conv.inner = untag_ptr(b);
37538         b_conv.is_owned = ptr_is_owned(b);
37539         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37540         b_conv.is_owned = false;
37541         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
37542         return ret_conv;
37543 }
37544
37545 void  __attribute__((export_name("TS_TxRemoveInput_free"))) TS_TxRemoveInput_free(uint64_t this_obj) {
37546         LDKTxRemoveInput this_obj_conv;
37547         this_obj_conv.inner = untag_ptr(this_obj);
37548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37550         TxRemoveInput_free(this_obj_conv);
37551 }
37552
37553 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_get_channel_id"))) TS_TxRemoveInput_get_channel_id(uint64_t this_ptr) {
37554         LDKTxRemoveInput this_ptr_conv;
37555         this_ptr_conv.inner = untag_ptr(this_ptr);
37556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37558         this_ptr_conv.is_owned = false;
37559         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37560         memcpy(ret_arr->elems, *TxRemoveInput_get_channel_id(&this_ptr_conv), 32);
37561         return ret_arr;
37562 }
37563
37564 void  __attribute__((export_name("TS_TxRemoveInput_set_channel_id"))) TS_TxRemoveInput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37565         LDKTxRemoveInput this_ptr_conv;
37566         this_ptr_conv.inner = untag_ptr(this_ptr);
37567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37569         this_ptr_conv.is_owned = false;
37570         LDKThirtyTwoBytes val_ref;
37571         CHECK(val->arr_len == 32);
37572         memcpy(val_ref.data, val->elems, 32); FREE(val);
37573         TxRemoveInput_set_channel_id(&this_ptr_conv, val_ref);
37574 }
37575
37576 int64_t  __attribute__((export_name("TS_TxRemoveInput_get_serial_id"))) TS_TxRemoveInput_get_serial_id(uint64_t this_ptr) {
37577         LDKTxRemoveInput this_ptr_conv;
37578         this_ptr_conv.inner = untag_ptr(this_ptr);
37579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37581         this_ptr_conv.is_owned = false;
37582         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
37583         return ret_conv;
37584 }
37585
37586 void  __attribute__((export_name("TS_TxRemoveInput_set_serial_id"))) TS_TxRemoveInput_set_serial_id(uint64_t this_ptr, int64_t val) {
37587         LDKTxRemoveInput this_ptr_conv;
37588         this_ptr_conv.inner = untag_ptr(this_ptr);
37589         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37591         this_ptr_conv.is_owned = false;
37592         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
37593 }
37594
37595 uint64_t  __attribute__((export_name("TS_TxRemoveInput_new"))) TS_TxRemoveInput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
37596         LDKThirtyTwoBytes channel_id_arg_ref;
37597         CHECK(channel_id_arg->arr_len == 32);
37598         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37599         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_ref, serial_id_arg);
37600         uint64_t ret_ref = 0;
37601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37603         return ret_ref;
37604 }
37605
37606 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
37607         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
37608         uint64_t ret_ref = 0;
37609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37611         return ret_ref;
37612 }
37613 int64_t  __attribute__((export_name("TS_TxRemoveInput_clone_ptr"))) TS_TxRemoveInput_clone_ptr(uint64_t arg) {
37614         LDKTxRemoveInput arg_conv;
37615         arg_conv.inner = untag_ptr(arg);
37616         arg_conv.is_owned = ptr_is_owned(arg);
37617         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37618         arg_conv.is_owned = false;
37619         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
37620         return ret_conv;
37621 }
37622
37623 uint64_t  __attribute__((export_name("TS_TxRemoveInput_clone"))) TS_TxRemoveInput_clone(uint64_t orig) {
37624         LDKTxRemoveInput orig_conv;
37625         orig_conv.inner = untag_ptr(orig);
37626         orig_conv.is_owned = ptr_is_owned(orig);
37627         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37628         orig_conv.is_owned = false;
37629         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
37630         uint64_t ret_ref = 0;
37631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37633         return ret_ref;
37634 }
37635
37636 jboolean  __attribute__((export_name("TS_TxRemoveInput_eq"))) TS_TxRemoveInput_eq(uint64_t a, uint64_t b) {
37637         LDKTxRemoveInput a_conv;
37638         a_conv.inner = untag_ptr(a);
37639         a_conv.is_owned = ptr_is_owned(a);
37640         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37641         a_conv.is_owned = false;
37642         LDKTxRemoveInput b_conv;
37643         b_conv.inner = untag_ptr(b);
37644         b_conv.is_owned = ptr_is_owned(b);
37645         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37646         b_conv.is_owned = false;
37647         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
37648         return ret_conv;
37649 }
37650
37651 void  __attribute__((export_name("TS_TxRemoveOutput_free"))) TS_TxRemoveOutput_free(uint64_t this_obj) {
37652         LDKTxRemoveOutput this_obj_conv;
37653         this_obj_conv.inner = untag_ptr(this_obj);
37654         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37655         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37656         TxRemoveOutput_free(this_obj_conv);
37657 }
37658
37659 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_get_channel_id"))) TS_TxRemoveOutput_get_channel_id(uint64_t this_ptr) {
37660         LDKTxRemoveOutput this_ptr_conv;
37661         this_ptr_conv.inner = untag_ptr(this_ptr);
37662         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37664         this_ptr_conv.is_owned = false;
37665         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37666         memcpy(ret_arr->elems, *TxRemoveOutput_get_channel_id(&this_ptr_conv), 32);
37667         return ret_arr;
37668 }
37669
37670 void  __attribute__((export_name("TS_TxRemoveOutput_set_channel_id"))) TS_TxRemoveOutput_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37671         LDKTxRemoveOutput this_ptr_conv;
37672         this_ptr_conv.inner = untag_ptr(this_ptr);
37673         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37675         this_ptr_conv.is_owned = false;
37676         LDKThirtyTwoBytes val_ref;
37677         CHECK(val->arr_len == 32);
37678         memcpy(val_ref.data, val->elems, 32); FREE(val);
37679         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_ref);
37680 }
37681
37682 int64_t  __attribute__((export_name("TS_TxRemoveOutput_get_serial_id"))) TS_TxRemoveOutput_get_serial_id(uint64_t this_ptr) {
37683         LDKTxRemoveOutput this_ptr_conv;
37684         this_ptr_conv.inner = untag_ptr(this_ptr);
37685         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37687         this_ptr_conv.is_owned = false;
37688         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
37689         return ret_conv;
37690 }
37691
37692 void  __attribute__((export_name("TS_TxRemoveOutput_set_serial_id"))) TS_TxRemoveOutput_set_serial_id(uint64_t this_ptr, int64_t val) {
37693         LDKTxRemoveOutput 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         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
37699 }
37700
37701 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_new"))) TS_TxRemoveOutput_new(int8_tArray channel_id_arg, int64_t serial_id_arg) {
37702         LDKThirtyTwoBytes channel_id_arg_ref;
37703         CHECK(channel_id_arg->arr_len == 32);
37704         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37705         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_ref, serial_id_arg);
37706         uint64_t ret_ref = 0;
37707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37709         return ret_ref;
37710 }
37711
37712 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
37713         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
37714         uint64_t ret_ref = 0;
37715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37717         return ret_ref;
37718 }
37719 int64_t  __attribute__((export_name("TS_TxRemoveOutput_clone_ptr"))) TS_TxRemoveOutput_clone_ptr(uint64_t arg) {
37720         LDKTxRemoveOutput arg_conv;
37721         arg_conv.inner = untag_ptr(arg);
37722         arg_conv.is_owned = ptr_is_owned(arg);
37723         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37724         arg_conv.is_owned = false;
37725         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
37726         return ret_conv;
37727 }
37728
37729 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_clone"))) TS_TxRemoveOutput_clone(uint64_t orig) {
37730         LDKTxRemoveOutput orig_conv;
37731         orig_conv.inner = untag_ptr(orig);
37732         orig_conv.is_owned = ptr_is_owned(orig);
37733         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37734         orig_conv.is_owned = false;
37735         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
37736         uint64_t ret_ref = 0;
37737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37739         return ret_ref;
37740 }
37741
37742 jboolean  __attribute__((export_name("TS_TxRemoveOutput_eq"))) TS_TxRemoveOutput_eq(uint64_t a, uint64_t b) {
37743         LDKTxRemoveOutput a_conv;
37744         a_conv.inner = untag_ptr(a);
37745         a_conv.is_owned = ptr_is_owned(a);
37746         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37747         a_conv.is_owned = false;
37748         LDKTxRemoveOutput b_conv;
37749         b_conv.inner = untag_ptr(b);
37750         b_conv.is_owned = ptr_is_owned(b);
37751         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37752         b_conv.is_owned = false;
37753         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
37754         return ret_conv;
37755 }
37756
37757 void  __attribute__((export_name("TS_TxComplete_free"))) TS_TxComplete_free(uint64_t this_obj) {
37758         LDKTxComplete this_obj_conv;
37759         this_obj_conv.inner = untag_ptr(this_obj);
37760         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37762         TxComplete_free(this_obj_conv);
37763 }
37764
37765 int8_tArray  __attribute__((export_name("TS_TxComplete_get_channel_id"))) TS_TxComplete_get_channel_id(uint64_t this_ptr) {
37766         LDKTxComplete this_ptr_conv;
37767         this_ptr_conv.inner = untag_ptr(this_ptr);
37768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37770         this_ptr_conv.is_owned = false;
37771         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37772         memcpy(ret_arr->elems, *TxComplete_get_channel_id(&this_ptr_conv), 32);
37773         return ret_arr;
37774 }
37775
37776 void  __attribute__((export_name("TS_TxComplete_set_channel_id"))) TS_TxComplete_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37777         LDKTxComplete this_ptr_conv;
37778         this_ptr_conv.inner = untag_ptr(this_ptr);
37779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37781         this_ptr_conv.is_owned = false;
37782         LDKThirtyTwoBytes val_ref;
37783         CHECK(val->arr_len == 32);
37784         memcpy(val_ref.data, val->elems, 32); FREE(val);
37785         TxComplete_set_channel_id(&this_ptr_conv, val_ref);
37786 }
37787
37788 uint64_t  __attribute__((export_name("TS_TxComplete_new"))) TS_TxComplete_new(int8_tArray channel_id_arg) {
37789         LDKThirtyTwoBytes channel_id_arg_ref;
37790         CHECK(channel_id_arg->arr_len == 32);
37791         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37792         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_ref);
37793         uint64_t ret_ref = 0;
37794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37796         return ret_ref;
37797 }
37798
37799 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
37800         LDKTxComplete ret_var = TxComplete_clone(arg);
37801         uint64_t ret_ref = 0;
37802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37804         return ret_ref;
37805 }
37806 int64_t  __attribute__((export_name("TS_TxComplete_clone_ptr"))) TS_TxComplete_clone_ptr(uint64_t arg) {
37807         LDKTxComplete arg_conv;
37808         arg_conv.inner = untag_ptr(arg);
37809         arg_conv.is_owned = ptr_is_owned(arg);
37810         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37811         arg_conv.is_owned = false;
37812         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
37813         return ret_conv;
37814 }
37815
37816 uint64_t  __attribute__((export_name("TS_TxComplete_clone"))) TS_TxComplete_clone(uint64_t orig) {
37817         LDKTxComplete orig_conv;
37818         orig_conv.inner = untag_ptr(orig);
37819         orig_conv.is_owned = ptr_is_owned(orig);
37820         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37821         orig_conv.is_owned = false;
37822         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
37823         uint64_t ret_ref = 0;
37824         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37825         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37826         return ret_ref;
37827 }
37828
37829 jboolean  __attribute__((export_name("TS_TxComplete_eq"))) TS_TxComplete_eq(uint64_t a, uint64_t b) {
37830         LDKTxComplete a_conv;
37831         a_conv.inner = untag_ptr(a);
37832         a_conv.is_owned = ptr_is_owned(a);
37833         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
37834         a_conv.is_owned = false;
37835         LDKTxComplete b_conv;
37836         b_conv.inner = untag_ptr(b);
37837         b_conv.is_owned = ptr_is_owned(b);
37838         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
37839         b_conv.is_owned = false;
37840         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
37841         return ret_conv;
37842 }
37843
37844 void  __attribute__((export_name("TS_TxSignatures_free"))) TS_TxSignatures_free(uint64_t this_obj) {
37845         LDKTxSignatures this_obj_conv;
37846         this_obj_conv.inner = untag_ptr(this_obj);
37847         this_obj_conv.is_owned = ptr_is_owned(this_obj);
37848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
37849         TxSignatures_free(this_obj_conv);
37850 }
37851
37852 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_channel_id"))) TS_TxSignatures_get_channel_id(uint64_t this_ptr) {
37853         LDKTxSignatures this_ptr_conv;
37854         this_ptr_conv.inner = untag_ptr(this_ptr);
37855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37857         this_ptr_conv.is_owned = false;
37858         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37859         memcpy(ret_arr->elems, *TxSignatures_get_channel_id(&this_ptr_conv), 32);
37860         return ret_arr;
37861 }
37862
37863 void  __attribute__((export_name("TS_TxSignatures_set_channel_id"))) TS_TxSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
37864         LDKTxSignatures this_ptr_conv;
37865         this_ptr_conv.inner = untag_ptr(this_ptr);
37866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37868         this_ptr_conv.is_owned = false;
37869         LDKThirtyTwoBytes val_ref;
37870         CHECK(val->arr_len == 32);
37871         memcpy(val_ref.data, val->elems, 32); FREE(val);
37872         TxSignatures_set_channel_id(&this_ptr_conv, val_ref);
37873 }
37874
37875 int8_tArray  __attribute__((export_name("TS_TxSignatures_get_tx_hash"))) TS_TxSignatures_get_tx_hash(uint64_t this_ptr) {
37876         LDKTxSignatures this_ptr_conv;
37877         this_ptr_conv.inner = untag_ptr(this_ptr);
37878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37880         this_ptr_conv.is_owned = false;
37881         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
37882         memcpy(ret_arr->elems, *TxSignatures_get_tx_hash(&this_ptr_conv), 32);
37883         return ret_arr;
37884 }
37885
37886 void  __attribute__((export_name("TS_TxSignatures_set_tx_hash"))) TS_TxSignatures_set_tx_hash(uint64_t this_ptr, int8_tArray val) {
37887         LDKTxSignatures this_ptr_conv;
37888         this_ptr_conv.inner = untag_ptr(this_ptr);
37889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37891         this_ptr_conv.is_owned = false;
37892         LDKThirtyTwoBytes val_ref;
37893         CHECK(val->arr_len == 32);
37894         memcpy(val_ref.data, val->elems, 32); FREE(val);
37895         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
37896 }
37897
37898 ptrArray  __attribute__((export_name("TS_TxSignatures_get_witnesses"))) TS_TxSignatures_get_witnesses(uint64_t this_ptr) {
37899         LDKTxSignatures this_ptr_conv;
37900         this_ptr_conv.inner = untag_ptr(this_ptr);
37901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37903         this_ptr_conv.is_owned = false;
37904         LDKCVec_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
37905         ptrArray ret_arr = NULL;
37906         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
37907         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
37908         for (size_t m = 0; m < ret_var.datalen; m++) {
37909                 LDKWitness ret_conv_12_var = ret_var.data[m];
37910                 int8_tArray ret_conv_12_arr = init_int8_tArray(ret_conv_12_var.datalen, __LINE__);
37911                 memcpy(ret_conv_12_arr->elems, ret_conv_12_var.data, ret_conv_12_var.datalen);
37912                 Witness_free(ret_conv_12_var);
37913                 ret_arr_ptr[m] = ret_conv_12_arr;
37914         }
37915         
37916         FREE(ret_var.data);
37917         return ret_arr;
37918 }
37919
37920 void  __attribute__((export_name("TS_TxSignatures_set_witnesses"))) TS_TxSignatures_set_witnesses(uint64_t this_ptr, ptrArray val) {
37921         LDKTxSignatures this_ptr_conv;
37922         this_ptr_conv.inner = untag_ptr(this_ptr);
37923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
37924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
37925         this_ptr_conv.is_owned = false;
37926         LDKCVec_WitnessZ val_constr;
37927         val_constr.datalen = val->arr_len;
37928         if (val_constr.datalen > 0)
37929                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
37930         else
37931                 val_constr.data = NULL;
37932         int8_tArray* val_vals = (void*) val->elems;
37933         for (size_t m = 0; m < val_constr.datalen; m++) {
37934                 int8_tArray val_conv_12 = val_vals[m];
37935                 LDKWitness val_conv_12_ref;
37936                 val_conv_12_ref.datalen = val_conv_12->arr_len;
37937                 val_conv_12_ref.data = MALLOC(val_conv_12_ref.datalen, "LDKWitness Bytes");
37938                 memcpy(val_conv_12_ref.data, val_conv_12->elems, val_conv_12_ref.datalen); FREE(val_conv_12);
37939                 val_conv_12_ref.data_is_owned = true;
37940                 val_constr.data[m] = val_conv_12_ref;
37941         }
37942         FREE(val);
37943         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
37944 }
37945
37946 uint64_t  __attribute__((export_name("TS_TxSignatures_new"))) TS_TxSignatures_new(int8_tArray channel_id_arg, int8_tArray tx_hash_arg, ptrArray witnesses_arg) {
37947         LDKThirtyTwoBytes channel_id_arg_ref;
37948         CHECK(channel_id_arg->arr_len == 32);
37949         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
37950         LDKThirtyTwoBytes tx_hash_arg_ref;
37951         CHECK(tx_hash_arg->arr_len == 32);
37952         memcpy(tx_hash_arg_ref.data, tx_hash_arg->elems, 32); FREE(tx_hash_arg);
37953         LDKCVec_WitnessZ witnesses_arg_constr;
37954         witnesses_arg_constr.datalen = witnesses_arg->arr_len;
37955         if (witnesses_arg_constr.datalen > 0)
37956                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
37957         else
37958                 witnesses_arg_constr.data = NULL;
37959         int8_tArray* witnesses_arg_vals = (void*) witnesses_arg->elems;
37960         for (size_t m = 0; m < witnesses_arg_constr.datalen; m++) {
37961                 int8_tArray witnesses_arg_conv_12 = witnesses_arg_vals[m];
37962                 LDKWitness witnesses_arg_conv_12_ref;
37963                 witnesses_arg_conv_12_ref.datalen = witnesses_arg_conv_12->arr_len;
37964                 witnesses_arg_conv_12_ref.data = MALLOC(witnesses_arg_conv_12_ref.datalen, "LDKWitness Bytes");
37965                 memcpy(witnesses_arg_conv_12_ref.data, witnesses_arg_conv_12->elems, witnesses_arg_conv_12_ref.datalen); FREE(witnesses_arg_conv_12);
37966                 witnesses_arg_conv_12_ref.data_is_owned = true;
37967                 witnesses_arg_constr.data[m] = witnesses_arg_conv_12_ref;
37968         }
37969         FREE(witnesses_arg);
37970         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_ref, tx_hash_arg_ref, witnesses_arg_constr);
37971         uint64_t ret_ref = 0;
37972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37974         return ret_ref;
37975 }
37976
37977 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
37978         LDKTxSignatures ret_var = TxSignatures_clone(arg);
37979         uint64_t ret_ref = 0;
37980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
37981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
37982         return ret_ref;
37983 }
37984 int64_t  __attribute__((export_name("TS_TxSignatures_clone_ptr"))) TS_TxSignatures_clone_ptr(uint64_t arg) {
37985         LDKTxSignatures arg_conv;
37986         arg_conv.inner = untag_ptr(arg);
37987         arg_conv.is_owned = ptr_is_owned(arg);
37988         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
37989         arg_conv.is_owned = false;
37990         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
37991         return ret_conv;
37992 }
37993
37994 uint64_t  __attribute__((export_name("TS_TxSignatures_clone"))) TS_TxSignatures_clone(uint64_t orig) {
37995         LDKTxSignatures orig_conv;
37996         orig_conv.inner = untag_ptr(orig);
37997         orig_conv.is_owned = ptr_is_owned(orig);
37998         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
37999         orig_conv.is_owned = false;
38000         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
38001         uint64_t ret_ref = 0;
38002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38004         return ret_ref;
38005 }
38006
38007 jboolean  __attribute__((export_name("TS_TxSignatures_eq"))) TS_TxSignatures_eq(uint64_t a, uint64_t b) {
38008         LDKTxSignatures a_conv;
38009         a_conv.inner = untag_ptr(a);
38010         a_conv.is_owned = ptr_is_owned(a);
38011         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38012         a_conv.is_owned = false;
38013         LDKTxSignatures b_conv;
38014         b_conv.inner = untag_ptr(b);
38015         b_conv.is_owned = ptr_is_owned(b);
38016         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38017         b_conv.is_owned = false;
38018         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
38019         return ret_conv;
38020 }
38021
38022 void  __attribute__((export_name("TS_TxInitRbf_free"))) TS_TxInitRbf_free(uint64_t this_obj) {
38023         LDKTxInitRbf this_obj_conv;
38024         this_obj_conv.inner = untag_ptr(this_obj);
38025         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38027         TxInitRbf_free(this_obj_conv);
38028 }
38029
38030 int8_tArray  __attribute__((export_name("TS_TxInitRbf_get_channel_id"))) TS_TxInitRbf_get_channel_id(uint64_t this_ptr) {
38031         LDKTxInitRbf this_ptr_conv;
38032         this_ptr_conv.inner = untag_ptr(this_ptr);
38033         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38035         this_ptr_conv.is_owned = false;
38036         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38037         memcpy(ret_arr->elems, *TxInitRbf_get_channel_id(&this_ptr_conv), 32);
38038         return ret_arr;
38039 }
38040
38041 void  __attribute__((export_name("TS_TxInitRbf_set_channel_id"))) TS_TxInitRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38042         LDKTxInitRbf this_ptr_conv;
38043         this_ptr_conv.inner = untag_ptr(this_ptr);
38044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38046         this_ptr_conv.is_owned = false;
38047         LDKThirtyTwoBytes val_ref;
38048         CHECK(val->arr_len == 32);
38049         memcpy(val_ref.data, val->elems, 32); FREE(val);
38050         TxInitRbf_set_channel_id(&this_ptr_conv, val_ref);
38051 }
38052
38053 int32_t  __attribute__((export_name("TS_TxInitRbf_get_locktime"))) TS_TxInitRbf_get_locktime(uint64_t this_ptr) {
38054         LDKTxInitRbf 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         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
38060         return ret_conv;
38061 }
38062
38063 void  __attribute__((export_name("TS_TxInitRbf_set_locktime"))) TS_TxInitRbf_set_locktime(uint64_t this_ptr, int32_t val) {
38064         LDKTxInitRbf 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         TxInitRbf_set_locktime(&this_ptr_conv, val);
38070 }
38071
38072 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) {
38073         LDKTxInitRbf 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         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
38079         return ret_conv;
38080 }
38081
38082 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) {
38083         LDKTxInitRbf this_ptr_conv;
38084         this_ptr_conv.inner = untag_ptr(this_ptr);
38085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38087         this_ptr_conv.is_owned = false;
38088         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
38089 }
38090
38091 uint64_t  __attribute__((export_name("TS_TxInitRbf_get_funding_output_contribution"))) TS_TxInitRbf_get_funding_output_contribution(uint64_t this_ptr) {
38092         LDKTxInitRbf this_ptr_conv;
38093         this_ptr_conv.inner = untag_ptr(this_ptr);
38094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38096         this_ptr_conv.is_owned = false;
38097         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
38098         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
38099         uint64_t ret_ref = tag_ptr(ret_copy, true);
38100         return ret_ref;
38101 }
38102
38103 void  __attribute__((export_name("TS_TxInitRbf_set_funding_output_contribution"))) TS_TxInitRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
38104         LDKTxInitRbf this_ptr_conv;
38105         this_ptr_conv.inner = untag_ptr(this_ptr);
38106         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38108         this_ptr_conv.is_owned = false;
38109         void* val_ptr = untag_ptr(val);
38110         CHECK_ACCESS(val_ptr);
38111         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
38112         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
38113         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
38114 }
38115
38116 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) {
38117         LDKThirtyTwoBytes channel_id_arg_ref;
38118         CHECK(channel_id_arg->arr_len == 32);
38119         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38120         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
38121         CHECK_ACCESS(funding_output_contribution_arg_ptr);
38122         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
38123         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
38124         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_ref, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
38125         uint64_t ret_ref = 0;
38126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38128         return ret_ref;
38129 }
38130
38131 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
38132         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
38133         uint64_t ret_ref = 0;
38134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38136         return ret_ref;
38137 }
38138 int64_t  __attribute__((export_name("TS_TxInitRbf_clone_ptr"))) TS_TxInitRbf_clone_ptr(uint64_t arg) {
38139         LDKTxInitRbf arg_conv;
38140         arg_conv.inner = untag_ptr(arg);
38141         arg_conv.is_owned = ptr_is_owned(arg);
38142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38143         arg_conv.is_owned = false;
38144         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
38145         return ret_conv;
38146 }
38147
38148 uint64_t  __attribute__((export_name("TS_TxInitRbf_clone"))) TS_TxInitRbf_clone(uint64_t orig) {
38149         LDKTxInitRbf orig_conv;
38150         orig_conv.inner = untag_ptr(orig);
38151         orig_conv.is_owned = ptr_is_owned(orig);
38152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38153         orig_conv.is_owned = false;
38154         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
38155         uint64_t ret_ref = 0;
38156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38158         return ret_ref;
38159 }
38160
38161 jboolean  __attribute__((export_name("TS_TxInitRbf_eq"))) TS_TxInitRbf_eq(uint64_t a, uint64_t b) {
38162         LDKTxInitRbf a_conv;
38163         a_conv.inner = untag_ptr(a);
38164         a_conv.is_owned = ptr_is_owned(a);
38165         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38166         a_conv.is_owned = false;
38167         LDKTxInitRbf b_conv;
38168         b_conv.inner = untag_ptr(b);
38169         b_conv.is_owned = ptr_is_owned(b);
38170         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38171         b_conv.is_owned = false;
38172         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
38173         return ret_conv;
38174 }
38175
38176 void  __attribute__((export_name("TS_TxAckRbf_free"))) TS_TxAckRbf_free(uint64_t this_obj) {
38177         LDKTxAckRbf this_obj_conv;
38178         this_obj_conv.inner = untag_ptr(this_obj);
38179         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38181         TxAckRbf_free(this_obj_conv);
38182 }
38183
38184 int8_tArray  __attribute__((export_name("TS_TxAckRbf_get_channel_id"))) TS_TxAckRbf_get_channel_id(uint64_t this_ptr) {
38185         LDKTxAckRbf this_ptr_conv;
38186         this_ptr_conv.inner = untag_ptr(this_ptr);
38187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38189         this_ptr_conv.is_owned = false;
38190         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38191         memcpy(ret_arr->elems, *TxAckRbf_get_channel_id(&this_ptr_conv), 32);
38192         return ret_arr;
38193 }
38194
38195 void  __attribute__((export_name("TS_TxAckRbf_set_channel_id"))) TS_TxAckRbf_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38196         LDKTxAckRbf this_ptr_conv;
38197         this_ptr_conv.inner = untag_ptr(this_ptr);
38198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38200         this_ptr_conv.is_owned = false;
38201         LDKThirtyTwoBytes val_ref;
38202         CHECK(val->arr_len == 32);
38203         memcpy(val_ref.data, val->elems, 32); FREE(val);
38204         TxAckRbf_set_channel_id(&this_ptr_conv, val_ref);
38205 }
38206
38207 uint64_t  __attribute__((export_name("TS_TxAckRbf_get_funding_output_contribution"))) TS_TxAckRbf_get_funding_output_contribution(uint64_t this_ptr) {
38208         LDKTxAckRbf this_ptr_conv;
38209         this_ptr_conv.inner = untag_ptr(this_ptr);
38210         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38212         this_ptr_conv.is_owned = false;
38213         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
38214         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
38215         uint64_t ret_ref = tag_ptr(ret_copy, true);
38216         return ret_ref;
38217 }
38218
38219 void  __attribute__((export_name("TS_TxAckRbf_set_funding_output_contribution"))) TS_TxAckRbf_set_funding_output_contribution(uint64_t this_ptr, uint64_t val) {
38220         LDKTxAckRbf this_ptr_conv;
38221         this_ptr_conv.inner = untag_ptr(this_ptr);
38222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38224         this_ptr_conv.is_owned = false;
38225         void* val_ptr = untag_ptr(val);
38226         CHECK_ACCESS(val_ptr);
38227         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
38228         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
38229         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
38230 }
38231
38232 uint64_t  __attribute__((export_name("TS_TxAckRbf_new"))) TS_TxAckRbf_new(int8_tArray channel_id_arg, uint64_t funding_output_contribution_arg) {
38233         LDKThirtyTwoBytes channel_id_arg_ref;
38234         CHECK(channel_id_arg->arr_len == 32);
38235         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38236         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
38237         CHECK_ACCESS(funding_output_contribution_arg_ptr);
38238         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
38239         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
38240         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_ref, funding_output_contribution_arg_conv);
38241         uint64_t ret_ref = 0;
38242         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38243         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38244         return ret_ref;
38245 }
38246
38247 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
38248         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
38249         uint64_t ret_ref = 0;
38250         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38251         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38252         return ret_ref;
38253 }
38254 int64_t  __attribute__((export_name("TS_TxAckRbf_clone_ptr"))) TS_TxAckRbf_clone_ptr(uint64_t arg) {
38255         LDKTxAckRbf arg_conv;
38256         arg_conv.inner = untag_ptr(arg);
38257         arg_conv.is_owned = ptr_is_owned(arg);
38258         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38259         arg_conv.is_owned = false;
38260         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
38261         return ret_conv;
38262 }
38263
38264 uint64_t  __attribute__((export_name("TS_TxAckRbf_clone"))) TS_TxAckRbf_clone(uint64_t orig) {
38265         LDKTxAckRbf orig_conv;
38266         orig_conv.inner = untag_ptr(orig);
38267         orig_conv.is_owned = ptr_is_owned(orig);
38268         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38269         orig_conv.is_owned = false;
38270         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
38271         uint64_t ret_ref = 0;
38272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38274         return ret_ref;
38275 }
38276
38277 jboolean  __attribute__((export_name("TS_TxAckRbf_eq"))) TS_TxAckRbf_eq(uint64_t a, uint64_t b) {
38278         LDKTxAckRbf a_conv;
38279         a_conv.inner = untag_ptr(a);
38280         a_conv.is_owned = ptr_is_owned(a);
38281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38282         a_conv.is_owned = false;
38283         LDKTxAckRbf b_conv;
38284         b_conv.inner = untag_ptr(b);
38285         b_conv.is_owned = ptr_is_owned(b);
38286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38287         b_conv.is_owned = false;
38288         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
38289         return ret_conv;
38290 }
38291
38292 void  __attribute__((export_name("TS_TxAbort_free"))) TS_TxAbort_free(uint64_t this_obj) {
38293         LDKTxAbort this_obj_conv;
38294         this_obj_conv.inner = untag_ptr(this_obj);
38295         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38297         TxAbort_free(this_obj_conv);
38298 }
38299
38300 int8_tArray  __attribute__((export_name("TS_TxAbort_get_channel_id"))) TS_TxAbort_get_channel_id(uint64_t this_ptr) {
38301         LDKTxAbort this_ptr_conv;
38302         this_ptr_conv.inner = untag_ptr(this_ptr);
38303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38305         this_ptr_conv.is_owned = false;
38306         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38307         memcpy(ret_arr->elems, *TxAbort_get_channel_id(&this_ptr_conv), 32);
38308         return ret_arr;
38309 }
38310
38311 void  __attribute__((export_name("TS_TxAbort_set_channel_id"))) TS_TxAbort_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38312         LDKTxAbort this_ptr_conv;
38313         this_ptr_conv.inner = untag_ptr(this_ptr);
38314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38316         this_ptr_conv.is_owned = false;
38317         LDKThirtyTwoBytes val_ref;
38318         CHECK(val->arr_len == 32);
38319         memcpy(val_ref.data, val->elems, 32); FREE(val);
38320         TxAbort_set_channel_id(&this_ptr_conv, val_ref);
38321 }
38322
38323 int8_tArray  __attribute__((export_name("TS_TxAbort_get_data"))) TS_TxAbort_get_data(uint64_t this_ptr) {
38324         LDKTxAbort this_ptr_conv;
38325         this_ptr_conv.inner = untag_ptr(this_ptr);
38326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38328         this_ptr_conv.is_owned = false;
38329         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
38330         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38331         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38332         CVec_u8Z_free(ret_var);
38333         return ret_arr;
38334 }
38335
38336 void  __attribute__((export_name("TS_TxAbort_set_data"))) TS_TxAbort_set_data(uint64_t this_ptr, int8_tArray val) {
38337         LDKTxAbort this_ptr_conv;
38338         this_ptr_conv.inner = untag_ptr(this_ptr);
38339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38341         this_ptr_conv.is_owned = false;
38342         LDKCVec_u8Z val_ref;
38343         val_ref.datalen = val->arr_len;
38344         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38345         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38346         TxAbort_set_data(&this_ptr_conv, val_ref);
38347 }
38348
38349 uint64_t  __attribute__((export_name("TS_TxAbort_new"))) TS_TxAbort_new(int8_tArray channel_id_arg, int8_tArray data_arg) {
38350         LDKThirtyTwoBytes channel_id_arg_ref;
38351         CHECK(channel_id_arg->arr_len == 32);
38352         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38353         LDKCVec_u8Z data_arg_ref;
38354         data_arg_ref.datalen = data_arg->arr_len;
38355         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38356         memcpy(data_arg_ref.data, data_arg->elems, data_arg_ref.datalen); FREE(data_arg);
38357         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_ref, data_arg_ref);
38358         uint64_t ret_ref = 0;
38359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38361         return ret_ref;
38362 }
38363
38364 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
38365         LDKTxAbort ret_var = TxAbort_clone(arg);
38366         uint64_t ret_ref = 0;
38367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38369         return ret_ref;
38370 }
38371 int64_t  __attribute__((export_name("TS_TxAbort_clone_ptr"))) TS_TxAbort_clone_ptr(uint64_t arg) {
38372         LDKTxAbort arg_conv;
38373         arg_conv.inner = untag_ptr(arg);
38374         arg_conv.is_owned = ptr_is_owned(arg);
38375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38376         arg_conv.is_owned = false;
38377         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
38378         return ret_conv;
38379 }
38380
38381 uint64_t  __attribute__((export_name("TS_TxAbort_clone"))) TS_TxAbort_clone(uint64_t orig) {
38382         LDKTxAbort orig_conv;
38383         orig_conv.inner = untag_ptr(orig);
38384         orig_conv.is_owned = ptr_is_owned(orig);
38385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38386         orig_conv.is_owned = false;
38387         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
38388         uint64_t ret_ref = 0;
38389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38391         return ret_ref;
38392 }
38393
38394 jboolean  __attribute__((export_name("TS_TxAbort_eq"))) TS_TxAbort_eq(uint64_t a, uint64_t b) {
38395         LDKTxAbort a_conv;
38396         a_conv.inner = untag_ptr(a);
38397         a_conv.is_owned = ptr_is_owned(a);
38398         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38399         a_conv.is_owned = false;
38400         LDKTxAbort b_conv;
38401         b_conv.inner = untag_ptr(b);
38402         b_conv.is_owned = ptr_is_owned(b);
38403         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38404         b_conv.is_owned = false;
38405         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
38406         return ret_conv;
38407 }
38408
38409 void  __attribute__((export_name("TS_Shutdown_free"))) TS_Shutdown_free(uint64_t this_obj) {
38410         LDKShutdown this_obj_conv;
38411         this_obj_conv.inner = untag_ptr(this_obj);
38412         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38414         Shutdown_free(this_obj_conv);
38415 }
38416
38417 int8_tArray  __attribute__((export_name("TS_Shutdown_get_channel_id"))) TS_Shutdown_get_channel_id(uint64_t this_ptr) {
38418         LDKShutdown this_ptr_conv;
38419         this_ptr_conv.inner = untag_ptr(this_ptr);
38420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38422         this_ptr_conv.is_owned = false;
38423         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38424         memcpy(ret_arr->elems, *Shutdown_get_channel_id(&this_ptr_conv), 32);
38425         return ret_arr;
38426 }
38427
38428 void  __attribute__((export_name("TS_Shutdown_set_channel_id"))) TS_Shutdown_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38429         LDKShutdown this_ptr_conv;
38430         this_ptr_conv.inner = untag_ptr(this_ptr);
38431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38433         this_ptr_conv.is_owned = false;
38434         LDKThirtyTwoBytes val_ref;
38435         CHECK(val->arr_len == 32);
38436         memcpy(val_ref.data, val->elems, 32); FREE(val);
38437         Shutdown_set_channel_id(&this_ptr_conv, val_ref);
38438 }
38439
38440 int8_tArray  __attribute__((export_name("TS_Shutdown_get_scriptpubkey"))) TS_Shutdown_get_scriptpubkey(uint64_t this_ptr) {
38441         LDKShutdown this_ptr_conv;
38442         this_ptr_conv.inner = untag_ptr(this_ptr);
38443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38445         this_ptr_conv.is_owned = false;
38446         LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
38447         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
38448         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
38449         return ret_arr;
38450 }
38451
38452 void  __attribute__((export_name("TS_Shutdown_set_scriptpubkey"))) TS_Shutdown_set_scriptpubkey(uint64_t this_ptr, int8_tArray val) {
38453         LDKShutdown 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         LDKCVec_u8Z val_ref;
38459         val_ref.datalen = val->arr_len;
38460         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
38461         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
38462         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
38463 }
38464
38465 uint64_t  __attribute__((export_name("TS_Shutdown_new"))) TS_Shutdown_new(int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
38466         LDKThirtyTwoBytes channel_id_arg_ref;
38467         CHECK(channel_id_arg->arr_len == 32);
38468         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38469         LDKCVec_u8Z scriptpubkey_arg_ref;
38470         scriptpubkey_arg_ref.datalen = scriptpubkey_arg->arr_len;
38471         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
38472         memcpy(scriptpubkey_arg_ref.data, scriptpubkey_arg->elems, scriptpubkey_arg_ref.datalen); FREE(scriptpubkey_arg);
38473         LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
38474         uint64_t ret_ref = 0;
38475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38477         return ret_ref;
38478 }
38479
38480 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
38481         LDKShutdown ret_var = Shutdown_clone(arg);
38482         uint64_t ret_ref = 0;
38483         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38484         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38485         return ret_ref;
38486 }
38487 int64_t  __attribute__((export_name("TS_Shutdown_clone_ptr"))) TS_Shutdown_clone_ptr(uint64_t arg) {
38488         LDKShutdown arg_conv;
38489         arg_conv.inner = untag_ptr(arg);
38490         arg_conv.is_owned = ptr_is_owned(arg);
38491         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38492         arg_conv.is_owned = false;
38493         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
38494         return ret_conv;
38495 }
38496
38497 uint64_t  __attribute__((export_name("TS_Shutdown_clone"))) TS_Shutdown_clone(uint64_t orig) {
38498         LDKShutdown orig_conv;
38499         orig_conv.inner = untag_ptr(orig);
38500         orig_conv.is_owned = ptr_is_owned(orig);
38501         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38502         orig_conv.is_owned = false;
38503         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
38504         uint64_t ret_ref = 0;
38505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38507         return ret_ref;
38508 }
38509
38510 jboolean  __attribute__((export_name("TS_Shutdown_eq"))) TS_Shutdown_eq(uint64_t a, uint64_t b) {
38511         LDKShutdown a_conv;
38512         a_conv.inner = untag_ptr(a);
38513         a_conv.is_owned = ptr_is_owned(a);
38514         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38515         a_conv.is_owned = false;
38516         LDKShutdown b_conv;
38517         b_conv.inner = untag_ptr(b);
38518         b_conv.is_owned = ptr_is_owned(b);
38519         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38520         b_conv.is_owned = false;
38521         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
38522         return ret_conv;
38523 }
38524
38525 void  __attribute__((export_name("TS_ClosingSignedFeeRange_free"))) TS_ClosingSignedFeeRange_free(uint64_t this_obj) {
38526         LDKClosingSignedFeeRange this_obj_conv;
38527         this_obj_conv.inner = untag_ptr(this_obj);
38528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38530         ClosingSignedFeeRange_free(this_obj_conv);
38531 }
38532
38533 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_min_fee_satoshis"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint64_t this_ptr) {
38534         LDKClosingSignedFeeRange this_ptr_conv;
38535         this_ptr_conv.inner = untag_ptr(this_ptr);
38536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38538         this_ptr_conv.is_owned = false;
38539         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
38540         return ret_conv;
38541 }
38542
38543 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_min_fee_satoshis"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint64_t this_ptr, int64_t val) {
38544         LDKClosingSignedFeeRange 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         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
38550 }
38551
38552 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_get_max_fee_satoshis"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint64_t this_ptr) {
38553         LDKClosingSignedFeeRange this_ptr_conv;
38554         this_ptr_conv.inner = untag_ptr(this_ptr);
38555         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38557         this_ptr_conv.is_owned = false;
38558         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
38559         return ret_conv;
38560 }
38561
38562 void  __attribute__((export_name("TS_ClosingSignedFeeRange_set_max_fee_satoshis"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint64_t this_ptr, int64_t val) {
38563         LDKClosingSignedFeeRange this_ptr_conv;
38564         this_ptr_conv.inner = untag_ptr(this_ptr);
38565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38567         this_ptr_conv.is_owned = false;
38568         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
38569 }
38570
38571 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_new"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
38572         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
38573         uint64_t ret_ref = 0;
38574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38576         return ret_ref;
38577 }
38578
38579 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
38580         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
38581         uint64_t ret_ref = 0;
38582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38584         return ret_ref;
38585 }
38586 int64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone_ptr"))) TS_ClosingSignedFeeRange_clone_ptr(uint64_t arg) {
38587         LDKClosingSignedFeeRange arg_conv;
38588         arg_conv.inner = untag_ptr(arg);
38589         arg_conv.is_owned = ptr_is_owned(arg);
38590         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38591         arg_conv.is_owned = false;
38592         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
38593         return ret_conv;
38594 }
38595
38596 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_clone"))) TS_ClosingSignedFeeRange_clone(uint64_t orig) {
38597         LDKClosingSignedFeeRange orig_conv;
38598         orig_conv.inner = untag_ptr(orig);
38599         orig_conv.is_owned = ptr_is_owned(orig);
38600         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38601         orig_conv.is_owned = false;
38602         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
38603         uint64_t ret_ref = 0;
38604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38606         return ret_ref;
38607 }
38608
38609 jboolean  __attribute__((export_name("TS_ClosingSignedFeeRange_eq"))) TS_ClosingSignedFeeRange_eq(uint64_t a, uint64_t b) {
38610         LDKClosingSignedFeeRange a_conv;
38611         a_conv.inner = untag_ptr(a);
38612         a_conv.is_owned = ptr_is_owned(a);
38613         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38614         a_conv.is_owned = false;
38615         LDKClosingSignedFeeRange b_conv;
38616         b_conv.inner = untag_ptr(b);
38617         b_conv.is_owned = ptr_is_owned(b);
38618         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38619         b_conv.is_owned = false;
38620         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
38621         return ret_conv;
38622 }
38623
38624 void  __attribute__((export_name("TS_ClosingSigned_free"))) TS_ClosingSigned_free(uint64_t this_obj) {
38625         LDKClosingSigned this_obj_conv;
38626         this_obj_conv.inner = untag_ptr(this_obj);
38627         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38629         ClosingSigned_free(this_obj_conv);
38630 }
38631
38632 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_channel_id"))) TS_ClosingSigned_get_channel_id(uint64_t this_ptr) {
38633         LDKClosingSigned this_ptr_conv;
38634         this_ptr_conv.inner = untag_ptr(this_ptr);
38635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38637         this_ptr_conv.is_owned = false;
38638         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38639         memcpy(ret_arr->elems, *ClosingSigned_get_channel_id(&this_ptr_conv), 32);
38640         return ret_arr;
38641 }
38642
38643 void  __attribute__((export_name("TS_ClosingSigned_set_channel_id"))) TS_ClosingSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38644         LDKClosingSigned this_ptr_conv;
38645         this_ptr_conv.inner = untag_ptr(this_ptr);
38646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38648         this_ptr_conv.is_owned = false;
38649         LDKThirtyTwoBytes val_ref;
38650         CHECK(val->arr_len == 32);
38651         memcpy(val_ref.data, val->elems, 32); FREE(val);
38652         ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
38653 }
38654
38655 int64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_satoshis"))) TS_ClosingSigned_get_fee_satoshis(uint64_t this_ptr) {
38656         LDKClosingSigned this_ptr_conv;
38657         this_ptr_conv.inner = untag_ptr(this_ptr);
38658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38660         this_ptr_conv.is_owned = false;
38661         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
38662         return ret_conv;
38663 }
38664
38665 void  __attribute__((export_name("TS_ClosingSigned_set_fee_satoshis"))) TS_ClosingSigned_set_fee_satoshis(uint64_t this_ptr, int64_t val) {
38666         LDKClosingSigned this_ptr_conv;
38667         this_ptr_conv.inner = untag_ptr(this_ptr);
38668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38670         this_ptr_conv.is_owned = false;
38671         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
38672 }
38673
38674 int8_tArray  __attribute__((export_name("TS_ClosingSigned_get_signature"))) TS_ClosingSigned_get_signature(uint64_t this_ptr) {
38675         LDKClosingSigned this_ptr_conv;
38676         this_ptr_conv.inner = untag_ptr(this_ptr);
38677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38679         this_ptr_conv.is_owned = false;
38680         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
38681         memcpy(ret_arr->elems, ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64);
38682         return ret_arr;
38683 }
38684
38685 void  __attribute__((export_name("TS_ClosingSigned_set_signature"))) TS_ClosingSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
38686         LDKClosingSigned this_ptr_conv;
38687         this_ptr_conv.inner = untag_ptr(this_ptr);
38688         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38689         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38690         this_ptr_conv.is_owned = false;
38691         LDKSignature val_ref;
38692         CHECK(val->arr_len == 64);
38693         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
38694         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
38695 }
38696
38697 uint64_t  __attribute__((export_name("TS_ClosingSigned_get_fee_range"))) TS_ClosingSigned_get_fee_range(uint64_t this_ptr) {
38698         LDKClosingSigned this_ptr_conv;
38699         this_ptr_conv.inner = untag_ptr(this_ptr);
38700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38702         this_ptr_conv.is_owned = false;
38703         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
38704         uint64_t ret_ref = 0;
38705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38707         return ret_ref;
38708 }
38709
38710 void  __attribute__((export_name("TS_ClosingSigned_set_fee_range"))) TS_ClosingSigned_set_fee_range(uint64_t this_ptr, uint64_t val) {
38711         LDKClosingSigned this_ptr_conv;
38712         this_ptr_conv.inner = untag_ptr(this_ptr);
38713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38715         this_ptr_conv.is_owned = false;
38716         LDKClosingSignedFeeRange val_conv;
38717         val_conv.inner = untag_ptr(val);
38718         val_conv.is_owned = ptr_is_owned(val);
38719         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
38720         val_conv = ClosingSignedFeeRange_clone(&val_conv);
38721         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
38722 }
38723
38724 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) {
38725         LDKThirtyTwoBytes channel_id_arg_ref;
38726         CHECK(channel_id_arg->arr_len == 32);
38727         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
38728         LDKSignature signature_arg_ref;
38729         CHECK(signature_arg->arr_len == 64);
38730         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
38731         LDKClosingSignedFeeRange fee_range_arg_conv;
38732         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
38733         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
38734         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
38735         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
38736         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
38737         uint64_t ret_ref = 0;
38738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38740         return ret_ref;
38741 }
38742
38743 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
38744         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
38745         uint64_t ret_ref = 0;
38746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38748         return ret_ref;
38749 }
38750 int64_t  __attribute__((export_name("TS_ClosingSigned_clone_ptr"))) TS_ClosingSigned_clone_ptr(uint64_t arg) {
38751         LDKClosingSigned arg_conv;
38752         arg_conv.inner = untag_ptr(arg);
38753         arg_conv.is_owned = ptr_is_owned(arg);
38754         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38755         arg_conv.is_owned = false;
38756         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
38757         return ret_conv;
38758 }
38759
38760 uint64_t  __attribute__((export_name("TS_ClosingSigned_clone"))) TS_ClosingSigned_clone(uint64_t orig) {
38761         LDKClosingSigned orig_conv;
38762         orig_conv.inner = untag_ptr(orig);
38763         orig_conv.is_owned = ptr_is_owned(orig);
38764         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38765         orig_conv.is_owned = false;
38766         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
38767         uint64_t ret_ref = 0;
38768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38770         return ret_ref;
38771 }
38772
38773 jboolean  __attribute__((export_name("TS_ClosingSigned_eq"))) TS_ClosingSigned_eq(uint64_t a, uint64_t b) {
38774         LDKClosingSigned a_conv;
38775         a_conv.inner = untag_ptr(a);
38776         a_conv.is_owned = ptr_is_owned(a);
38777         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38778         a_conv.is_owned = false;
38779         LDKClosingSigned b_conv;
38780         b_conv.inner = untag_ptr(b);
38781         b_conv.is_owned = ptr_is_owned(b);
38782         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38783         b_conv.is_owned = false;
38784         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
38785         return ret_conv;
38786 }
38787
38788 void  __attribute__((export_name("TS_UpdateAddHTLC_free"))) TS_UpdateAddHTLC_free(uint64_t this_obj) {
38789         LDKUpdateAddHTLC this_obj_conv;
38790         this_obj_conv.inner = untag_ptr(this_obj);
38791         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38793         UpdateAddHTLC_free(this_obj_conv);
38794 }
38795
38796 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_channel_id"))) TS_UpdateAddHTLC_get_channel_id(uint64_t this_ptr) {
38797         LDKUpdateAddHTLC this_ptr_conv;
38798         this_ptr_conv.inner = untag_ptr(this_ptr);
38799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38801         this_ptr_conv.is_owned = false;
38802         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38803         memcpy(ret_arr->elems, *UpdateAddHTLC_get_channel_id(&this_ptr_conv), 32);
38804         return ret_arr;
38805 }
38806
38807 void  __attribute__((export_name("TS_UpdateAddHTLC_set_channel_id"))) TS_UpdateAddHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
38808         LDKUpdateAddHTLC this_ptr_conv;
38809         this_ptr_conv.inner = untag_ptr(this_ptr);
38810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38812         this_ptr_conv.is_owned = false;
38813         LDKThirtyTwoBytes val_ref;
38814         CHECK(val->arr_len == 32);
38815         memcpy(val_ref.data, val->elems, 32); FREE(val);
38816         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
38817 }
38818
38819 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_htlc_id"))) TS_UpdateAddHTLC_get_htlc_id(uint64_t this_ptr) {
38820         LDKUpdateAddHTLC this_ptr_conv;
38821         this_ptr_conv.inner = untag_ptr(this_ptr);
38822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38824         this_ptr_conv.is_owned = false;
38825         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
38826         return ret_conv;
38827 }
38828
38829 void  __attribute__((export_name("TS_UpdateAddHTLC_set_htlc_id"))) TS_UpdateAddHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
38830         LDKUpdateAddHTLC this_ptr_conv;
38831         this_ptr_conv.inner = untag_ptr(this_ptr);
38832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38834         this_ptr_conv.is_owned = false;
38835         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
38836 }
38837
38838 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_amount_msat"))) TS_UpdateAddHTLC_get_amount_msat(uint64_t this_ptr) {
38839         LDKUpdateAddHTLC this_ptr_conv;
38840         this_ptr_conv.inner = untag_ptr(this_ptr);
38841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38843         this_ptr_conv.is_owned = false;
38844         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
38845         return ret_conv;
38846 }
38847
38848 void  __attribute__((export_name("TS_UpdateAddHTLC_set_amount_msat"))) TS_UpdateAddHTLC_set_amount_msat(uint64_t this_ptr, int64_t val) {
38849         LDKUpdateAddHTLC 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         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
38855 }
38856
38857 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_get_payment_hash"))) TS_UpdateAddHTLC_get_payment_hash(uint64_t this_ptr) {
38858         LDKUpdateAddHTLC this_ptr_conv;
38859         this_ptr_conv.inner = untag_ptr(this_ptr);
38860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38862         this_ptr_conv.is_owned = false;
38863         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
38864         memcpy(ret_arr->elems, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv), 32);
38865         return ret_arr;
38866 }
38867
38868 void  __attribute__((export_name("TS_UpdateAddHTLC_set_payment_hash"))) TS_UpdateAddHTLC_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
38869         LDKUpdateAddHTLC this_ptr_conv;
38870         this_ptr_conv.inner = untag_ptr(this_ptr);
38871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38873         this_ptr_conv.is_owned = false;
38874         LDKThirtyTwoBytes val_ref;
38875         CHECK(val->arr_len == 32);
38876         memcpy(val_ref.data, val->elems, 32); FREE(val);
38877         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
38878 }
38879
38880 int32_t  __attribute__((export_name("TS_UpdateAddHTLC_get_cltv_expiry"))) TS_UpdateAddHTLC_get_cltv_expiry(uint64_t this_ptr) {
38881         LDKUpdateAddHTLC this_ptr_conv;
38882         this_ptr_conv.inner = untag_ptr(this_ptr);
38883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38885         this_ptr_conv.is_owned = false;
38886         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
38887         return ret_conv;
38888 }
38889
38890 void  __attribute__((export_name("TS_UpdateAddHTLC_set_cltv_expiry"))) TS_UpdateAddHTLC_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
38891         LDKUpdateAddHTLC this_ptr_conv;
38892         this_ptr_conv.inner = untag_ptr(this_ptr);
38893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38895         this_ptr_conv.is_owned = false;
38896         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
38897 }
38898
38899 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_get_skimmed_fee_msat"))) TS_UpdateAddHTLC_get_skimmed_fee_msat(uint64_t this_ptr) {
38900         LDKUpdateAddHTLC this_ptr_conv;
38901         this_ptr_conv.inner = untag_ptr(this_ptr);
38902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38904         this_ptr_conv.is_owned = false;
38905         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
38906         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
38907         uint64_t ret_ref = tag_ptr(ret_copy, true);
38908         return ret_ref;
38909 }
38910
38911 void  __attribute__((export_name("TS_UpdateAddHTLC_set_skimmed_fee_msat"))) TS_UpdateAddHTLC_set_skimmed_fee_msat(uint64_t this_ptr, uint64_t val) {
38912         LDKUpdateAddHTLC this_ptr_conv;
38913         this_ptr_conv.inner = untag_ptr(this_ptr);
38914         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38915         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38916         this_ptr_conv.is_owned = false;
38917         void* val_ptr = untag_ptr(val);
38918         CHECK_ACCESS(val_ptr);
38919         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
38920         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
38921         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
38922 }
38923
38924 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
38925         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
38926         uint64_t ret_ref = 0;
38927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38929         return ret_ref;
38930 }
38931 int64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone_ptr"))) TS_UpdateAddHTLC_clone_ptr(uint64_t arg) {
38932         LDKUpdateAddHTLC arg_conv;
38933         arg_conv.inner = untag_ptr(arg);
38934         arg_conv.is_owned = ptr_is_owned(arg);
38935         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
38936         arg_conv.is_owned = false;
38937         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
38938         return ret_conv;
38939 }
38940
38941 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_clone"))) TS_UpdateAddHTLC_clone(uint64_t orig) {
38942         LDKUpdateAddHTLC orig_conv;
38943         orig_conv.inner = untag_ptr(orig);
38944         orig_conv.is_owned = ptr_is_owned(orig);
38945         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
38946         orig_conv.is_owned = false;
38947         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
38948         uint64_t ret_ref = 0;
38949         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
38950         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
38951         return ret_ref;
38952 }
38953
38954 jboolean  __attribute__((export_name("TS_UpdateAddHTLC_eq"))) TS_UpdateAddHTLC_eq(uint64_t a, uint64_t b) {
38955         LDKUpdateAddHTLC a_conv;
38956         a_conv.inner = untag_ptr(a);
38957         a_conv.is_owned = ptr_is_owned(a);
38958         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38959         a_conv.is_owned = false;
38960         LDKUpdateAddHTLC b_conv;
38961         b_conv.inner = untag_ptr(b);
38962         b_conv.is_owned = ptr_is_owned(b);
38963         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
38964         b_conv.is_owned = false;
38965         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
38966         return ret_conv;
38967 }
38968
38969 void  __attribute__((export_name("TS_OnionMessage_free"))) TS_OnionMessage_free(uint64_t this_obj) {
38970         LDKOnionMessage this_obj_conv;
38971         this_obj_conv.inner = untag_ptr(this_obj);
38972         this_obj_conv.is_owned = ptr_is_owned(this_obj);
38973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
38974         OnionMessage_free(this_obj_conv);
38975 }
38976
38977 int8_tArray  __attribute__((export_name("TS_OnionMessage_get_blinding_point"))) TS_OnionMessage_get_blinding_point(uint64_t this_ptr) {
38978         LDKOnionMessage this_ptr_conv;
38979         this_ptr_conv.inner = untag_ptr(this_ptr);
38980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38982         this_ptr_conv.is_owned = false;
38983         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
38984         memcpy(ret_arr->elems, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form, 33);
38985         return ret_arr;
38986 }
38987
38988 void  __attribute__((export_name("TS_OnionMessage_set_blinding_point"))) TS_OnionMessage_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
38989         LDKOnionMessage this_ptr_conv;
38990         this_ptr_conv.inner = untag_ptr(this_ptr);
38991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
38992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
38993         this_ptr_conv.is_owned = false;
38994         LDKPublicKey val_ref;
38995         CHECK(val->arr_len == 33);
38996         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
38997         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
38998 }
38999
39000 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
39001         LDKOnionMessage ret_var = OnionMessage_clone(arg);
39002         uint64_t ret_ref = 0;
39003         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39004         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39005         return ret_ref;
39006 }
39007 int64_t  __attribute__((export_name("TS_OnionMessage_clone_ptr"))) TS_OnionMessage_clone_ptr(uint64_t arg) {
39008         LDKOnionMessage arg_conv;
39009         arg_conv.inner = untag_ptr(arg);
39010         arg_conv.is_owned = ptr_is_owned(arg);
39011         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39012         arg_conv.is_owned = false;
39013         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
39014         return ret_conv;
39015 }
39016
39017 uint64_t  __attribute__((export_name("TS_OnionMessage_clone"))) TS_OnionMessage_clone(uint64_t orig) {
39018         LDKOnionMessage orig_conv;
39019         orig_conv.inner = untag_ptr(orig);
39020         orig_conv.is_owned = ptr_is_owned(orig);
39021         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39022         orig_conv.is_owned = false;
39023         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
39024         uint64_t ret_ref = 0;
39025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39027         return ret_ref;
39028 }
39029
39030 jboolean  __attribute__((export_name("TS_OnionMessage_eq"))) TS_OnionMessage_eq(uint64_t a, uint64_t b) {
39031         LDKOnionMessage a_conv;
39032         a_conv.inner = untag_ptr(a);
39033         a_conv.is_owned = ptr_is_owned(a);
39034         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39035         a_conv.is_owned = false;
39036         LDKOnionMessage b_conv;
39037         b_conv.inner = untag_ptr(b);
39038         b_conv.is_owned = ptr_is_owned(b);
39039         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39040         b_conv.is_owned = false;
39041         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
39042         return ret_conv;
39043 }
39044
39045 void  __attribute__((export_name("TS_UpdateFulfillHTLC_free"))) TS_UpdateFulfillHTLC_free(uint64_t this_obj) {
39046         LDKUpdateFulfillHTLC this_obj_conv;
39047         this_obj_conv.inner = untag_ptr(this_obj);
39048         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39050         UpdateFulfillHTLC_free(this_obj_conv);
39051 }
39052
39053 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_channel_id"))) TS_UpdateFulfillHTLC_get_channel_id(uint64_t this_ptr) {
39054         LDKUpdateFulfillHTLC this_ptr_conv;
39055         this_ptr_conv.inner = untag_ptr(this_ptr);
39056         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39058         this_ptr_conv.is_owned = false;
39059         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39060         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv), 32);
39061         return ret_arr;
39062 }
39063
39064 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_channel_id"))) TS_UpdateFulfillHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39065         LDKUpdateFulfillHTLC this_ptr_conv;
39066         this_ptr_conv.inner = untag_ptr(this_ptr);
39067         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39069         this_ptr_conv.is_owned = false;
39070         LDKThirtyTwoBytes val_ref;
39071         CHECK(val->arr_len == 32);
39072         memcpy(val_ref.data, val->elems, 32); FREE(val);
39073         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
39074 }
39075
39076 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_get_htlc_id"))) TS_UpdateFulfillHTLC_get_htlc_id(uint64_t this_ptr) {
39077         LDKUpdateFulfillHTLC this_ptr_conv;
39078         this_ptr_conv.inner = untag_ptr(this_ptr);
39079         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39081         this_ptr_conv.is_owned = false;
39082         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
39083         return ret_conv;
39084 }
39085
39086 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_htlc_id"))) TS_UpdateFulfillHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
39087         LDKUpdateFulfillHTLC this_ptr_conv;
39088         this_ptr_conv.inner = untag_ptr(this_ptr);
39089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39091         this_ptr_conv.is_owned = false;
39092         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
39093 }
39094
39095 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_get_payment_preimage"))) TS_UpdateFulfillHTLC_get_payment_preimage(uint64_t this_ptr) {
39096         LDKUpdateFulfillHTLC this_ptr_conv;
39097         this_ptr_conv.inner = untag_ptr(this_ptr);
39098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39100         this_ptr_conv.is_owned = false;
39101         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39102         memcpy(ret_arr->elems, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv), 32);
39103         return ret_arr;
39104 }
39105
39106 void  __attribute__((export_name("TS_UpdateFulfillHTLC_set_payment_preimage"))) TS_UpdateFulfillHTLC_set_payment_preimage(uint64_t this_ptr, int8_tArray val) {
39107         LDKUpdateFulfillHTLC this_ptr_conv;
39108         this_ptr_conv.inner = untag_ptr(this_ptr);
39109         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39110         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39111         this_ptr_conv.is_owned = false;
39112         LDKThirtyTwoBytes val_ref;
39113         CHECK(val->arr_len == 32);
39114         memcpy(val_ref.data, val->elems, 32); FREE(val);
39115         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
39116 }
39117
39118 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) {
39119         LDKThirtyTwoBytes channel_id_arg_ref;
39120         CHECK(channel_id_arg->arr_len == 32);
39121         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39122         LDKThirtyTwoBytes payment_preimage_arg_ref;
39123         CHECK(payment_preimage_arg->arr_len == 32);
39124         memcpy(payment_preimage_arg_ref.data, payment_preimage_arg->elems, 32); FREE(payment_preimage_arg);
39125         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
39126         uint64_t ret_ref = 0;
39127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39129         return ret_ref;
39130 }
39131
39132 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
39133         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
39134         uint64_t ret_ref = 0;
39135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39137         return ret_ref;
39138 }
39139 int64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone_ptr"))) TS_UpdateFulfillHTLC_clone_ptr(uint64_t arg) {
39140         LDKUpdateFulfillHTLC arg_conv;
39141         arg_conv.inner = untag_ptr(arg);
39142         arg_conv.is_owned = ptr_is_owned(arg);
39143         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39144         arg_conv.is_owned = false;
39145         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
39146         return ret_conv;
39147 }
39148
39149 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_clone"))) TS_UpdateFulfillHTLC_clone(uint64_t orig) {
39150         LDKUpdateFulfillHTLC orig_conv;
39151         orig_conv.inner = untag_ptr(orig);
39152         orig_conv.is_owned = ptr_is_owned(orig);
39153         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39154         orig_conv.is_owned = false;
39155         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
39156         uint64_t ret_ref = 0;
39157         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39158         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39159         return ret_ref;
39160 }
39161
39162 jboolean  __attribute__((export_name("TS_UpdateFulfillHTLC_eq"))) TS_UpdateFulfillHTLC_eq(uint64_t a, uint64_t b) {
39163         LDKUpdateFulfillHTLC a_conv;
39164         a_conv.inner = untag_ptr(a);
39165         a_conv.is_owned = ptr_is_owned(a);
39166         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39167         a_conv.is_owned = false;
39168         LDKUpdateFulfillHTLC b_conv;
39169         b_conv.inner = untag_ptr(b);
39170         b_conv.is_owned = ptr_is_owned(b);
39171         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39172         b_conv.is_owned = false;
39173         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
39174         return ret_conv;
39175 }
39176
39177 void  __attribute__((export_name("TS_UpdateFailHTLC_free"))) TS_UpdateFailHTLC_free(uint64_t this_obj) {
39178         LDKUpdateFailHTLC this_obj_conv;
39179         this_obj_conv.inner = untag_ptr(this_obj);
39180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39182         UpdateFailHTLC_free(this_obj_conv);
39183 }
39184
39185 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_get_channel_id"))) TS_UpdateFailHTLC_get_channel_id(uint64_t this_ptr) {
39186         LDKUpdateFailHTLC this_ptr_conv;
39187         this_ptr_conv.inner = untag_ptr(this_ptr);
39188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39190         this_ptr_conv.is_owned = false;
39191         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39192         memcpy(ret_arr->elems, *UpdateFailHTLC_get_channel_id(&this_ptr_conv), 32);
39193         return ret_arr;
39194 }
39195
39196 void  __attribute__((export_name("TS_UpdateFailHTLC_set_channel_id"))) TS_UpdateFailHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39197         LDKUpdateFailHTLC this_ptr_conv;
39198         this_ptr_conv.inner = untag_ptr(this_ptr);
39199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39201         this_ptr_conv.is_owned = false;
39202         LDKThirtyTwoBytes val_ref;
39203         CHECK(val->arr_len == 32);
39204         memcpy(val_ref.data, val->elems, 32); FREE(val);
39205         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
39206 }
39207
39208 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_get_htlc_id"))) TS_UpdateFailHTLC_get_htlc_id(uint64_t this_ptr) {
39209         LDKUpdateFailHTLC this_ptr_conv;
39210         this_ptr_conv.inner = untag_ptr(this_ptr);
39211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39213         this_ptr_conv.is_owned = false;
39214         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
39215         return ret_conv;
39216 }
39217
39218 void  __attribute__((export_name("TS_UpdateFailHTLC_set_htlc_id"))) TS_UpdateFailHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
39219         LDKUpdateFailHTLC this_ptr_conv;
39220         this_ptr_conv.inner = untag_ptr(this_ptr);
39221         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39223         this_ptr_conv.is_owned = false;
39224         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
39225 }
39226
39227 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
39228         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
39229         uint64_t ret_ref = 0;
39230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39232         return ret_ref;
39233 }
39234 int64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone_ptr"))) TS_UpdateFailHTLC_clone_ptr(uint64_t arg) {
39235         LDKUpdateFailHTLC arg_conv;
39236         arg_conv.inner = untag_ptr(arg);
39237         arg_conv.is_owned = ptr_is_owned(arg);
39238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39239         arg_conv.is_owned = false;
39240         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
39241         return ret_conv;
39242 }
39243
39244 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_clone"))) TS_UpdateFailHTLC_clone(uint64_t orig) {
39245         LDKUpdateFailHTLC orig_conv;
39246         orig_conv.inner = untag_ptr(orig);
39247         orig_conv.is_owned = ptr_is_owned(orig);
39248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39249         orig_conv.is_owned = false;
39250         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
39251         uint64_t ret_ref = 0;
39252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39254         return ret_ref;
39255 }
39256
39257 jboolean  __attribute__((export_name("TS_UpdateFailHTLC_eq"))) TS_UpdateFailHTLC_eq(uint64_t a, uint64_t b) {
39258         LDKUpdateFailHTLC a_conv;
39259         a_conv.inner = untag_ptr(a);
39260         a_conv.is_owned = ptr_is_owned(a);
39261         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39262         a_conv.is_owned = false;
39263         LDKUpdateFailHTLC b_conv;
39264         b_conv.inner = untag_ptr(b);
39265         b_conv.is_owned = ptr_is_owned(b);
39266         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39267         b_conv.is_owned = false;
39268         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
39269         return ret_conv;
39270 }
39271
39272 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_free"))) TS_UpdateFailMalformedHTLC_free(uint64_t this_obj) {
39273         LDKUpdateFailMalformedHTLC this_obj_conv;
39274         this_obj_conv.inner = untag_ptr(this_obj);
39275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39277         UpdateFailMalformedHTLC_free(this_obj_conv);
39278 }
39279
39280 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_channel_id"))) TS_UpdateFailMalformedHTLC_get_channel_id(uint64_t this_ptr) {
39281         LDKUpdateFailMalformedHTLC this_ptr_conv;
39282         this_ptr_conv.inner = untag_ptr(this_ptr);
39283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39285         this_ptr_conv.is_owned = false;
39286         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39287         memcpy(ret_arr->elems, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv), 32);
39288         return ret_arr;
39289 }
39290
39291 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_channel_id"))) TS_UpdateFailMalformedHTLC_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39292         LDKUpdateFailMalformedHTLC this_ptr_conv;
39293         this_ptr_conv.inner = untag_ptr(this_ptr);
39294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39296         this_ptr_conv.is_owned = false;
39297         LDKThirtyTwoBytes val_ref;
39298         CHECK(val->arr_len == 32);
39299         memcpy(val_ref.data, val->elems, 32); FREE(val);
39300         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
39301 }
39302
39303 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_htlc_id"))) TS_UpdateFailMalformedHTLC_get_htlc_id(uint64_t this_ptr) {
39304         LDKUpdateFailMalformedHTLC this_ptr_conv;
39305         this_ptr_conv.inner = untag_ptr(this_ptr);
39306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39308         this_ptr_conv.is_owned = false;
39309         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
39310         return ret_conv;
39311 }
39312
39313 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_htlc_id"))) TS_UpdateFailMalformedHTLC_set_htlc_id(uint64_t this_ptr, int64_t val) {
39314         LDKUpdateFailMalformedHTLC this_ptr_conv;
39315         this_ptr_conv.inner = untag_ptr(this_ptr);
39316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39318         this_ptr_conv.is_owned = false;
39319         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
39320 }
39321
39322 int16_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_get_failure_code"))) TS_UpdateFailMalformedHTLC_get_failure_code(uint64_t this_ptr) {
39323         LDKUpdateFailMalformedHTLC this_ptr_conv;
39324         this_ptr_conv.inner = untag_ptr(this_ptr);
39325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39327         this_ptr_conv.is_owned = false;
39328         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
39329         return ret_conv;
39330 }
39331
39332 void  __attribute__((export_name("TS_UpdateFailMalformedHTLC_set_failure_code"))) TS_UpdateFailMalformedHTLC_set_failure_code(uint64_t this_ptr, int16_t val) {
39333         LDKUpdateFailMalformedHTLC this_ptr_conv;
39334         this_ptr_conv.inner = untag_ptr(this_ptr);
39335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39337         this_ptr_conv.is_owned = false;
39338         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
39339 }
39340
39341 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
39342         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
39343         uint64_t ret_ref = 0;
39344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39346         return ret_ref;
39347 }
39348 int64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone_ptr"))) TS_UpdateFailMalformedHTLC_clone_ptr(uint64_t arg) {
39349         LDKUpdateFailMalformedHTLC arg_conv;
39350         arg_conv.inner = untag_ptr(arg);
39351         arg_conv.is_owned = ptr_is_owned(arg);
39352         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39353         arg_conv.is_owned = false;
39354         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
39355         return ret_conv;
39356 }
39357
39358 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_clone"))) TS_UpdateFailMalformedHTLC_clone(uint64_t orig) {
39359         LDKUpdateFailMalformedHTLC orig_conv;
39360         orig_conv.inner = untag_ptr(orig);
39361         orig_conv.is_owned = ptr_is_owned(orig);
39362         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39363         orig_conv.is_owned = false;
39364         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
39365         uint64_t ret_ref = 0;
39366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39368         return ret_ref;
39369 }
39370
39371 jboolean  __attribute__((export_name("TS_UpdateFailMalformedHTLC_eq"))) TS_UpdateFailMalformedHTLC_eq(uint64_t a, uint64_t b) {
39372         LDKUpdateFailMalformedHTLC a_conv;
39373         a_conv.inner = untag_ptr(a);
39374         a_conv.is_owned = ptr_is_owned(a);
39375         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39376         a_conv.is_owned = false;
39377         LDKUpdateFailMalformedHTLC b_conv;
39378         b_conv.inner = untag_ptr(b);
39379         b_conv.is_owned = ptr_is_owned(b);
39380         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39381         b_conv.is_owned = false;
39382         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
39383         return ret_conv;
39384 }
39385
39386 void  __attribute__((export_name("TS_CommitmentSigned_free"))) TS_CommitmentSigned_free(uint64_t this_obj) {
39387         LDKCommitmentSigned this_obj_conv;
39388         this_obj_conv.inner = untag_ptr(this_obj);
39389         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39391         CommitmentSigned_free(this_obj_conv);
39392 }
39393
39394 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_channel_id"))) TS_CommitmentSigned_get_channel_id(uint64_t this_ptr) {
39395         LDKCommitmentSigned this_ptr_conv;
39396         this_ptr_conv.inner = untag_ptr(this_ptr);
39397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39399         this_ptr_conv.is_owned = false;
39400         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39401         memcpy(ret_arr->elems, *CommitmentSigned_get_channel_id(&this_ptr_conv), 32);
39402         return ret_arr;
39403 }
39404
39405 void  __attribute__((export_name("TS_CommitmentSigned_set_channel_id"))) TS_CommitmentSigned_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39406         LDKCommitmentSigned this_ptr_conv;
39407         this_ptr_conv.inner = untag_ptr(this_ptr);
39408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39410         this_ptr_conv.is_owned = false;
39411         LDKThirtyTwoBytes val_ref;
39412         CHECK(val->arr_len == 32);
39413         memcpy(val_ref.data, val->elems, 32); FREE(val);
39414         CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
39415 }
39416
39417 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_get_signature"))) TS_CommitmentSigned_get_signature(uint64_t this_ptr) {
39418         LDKCommitmentSigned this_ptr_conv;
39419         this_ptr_conv.inner = untag_ptr(this_ptr);
39420         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39422         this_ptr_conv.is_owned = false;
39423         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
39424         memcpy(ret_arr->elems, CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64);
39425         return ret_arr;
39426 }
39427
39428 void  __attribute__((export_name("TS_CommitmentSigned_set_signature"))) TS_CommitmentSigned_set_signature(uint64_t this_ptr, int8_tArray val) {
39429         LDKCommitmentSigned this_ptr_conv;
39430         this_ptr_conv.inner = untag_ptr(this_ptr);
39431         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39433         this_ptr_conv.is_owned = false;
39434         LDKSignature val_ref;
39435         CHECK(val->arr_len == 64);
39436         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
39437         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
39438 }
39439
39440 ptrArray  __attribute__((export_name("TS_CommitmentSigned_get_htlc_signatures"))) TS_CommitmentSigned_get_htlc_signatures(uint64_t this_ptr) {
39441         LDKCommitmentSigned this_ptr_conv;
39442         this_ptr_conv.inner = untag_ptr(this_ptr);
39443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39445         this_ptr_conv.is_owned = false;
39446         LDKCVec_SignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
39447         ptrArray ret_arr = NULL;
39448         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
39449         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
39450         for (size_t m = 0; m < ret_var.datalen; m++) {
39451                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
39452                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
39453                 ret_arr_ptr[m] = ret_conv_12_arr;
39454         }
39455         
39456         FREE(ret_var.data);
39457         return ret_arr;
39458 }
39459
39460 void  __attribute__((export_name("TS_CommitmentSigned_set_htlc_signatures"))) TS_CommitmentSigned_set_htlc_signatures(uint64_t this_ptr, ptrArray val) {
39461         LDKCommitmentSigned this_ptr_conv;
39462         this_ptr_conv.inner = untag_ptr(this_ptr);
39463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39465         this_ptr_conv.is_owned = false;
39466         LDKCVec_SignatureZ val_constr;
39467         val_constr.datalen = val->arr_len;
39468         if (val_constr.datalen > 0)
39469                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39470         else
39471                 val_constr.data = NULL;
39472         int8_tArray* val_vals = (void*) val->elems;
39473         for (size_t m = 0; m < val_constr.datalen; m++) {
39474                 int8_tArray val_conv_12 = val_vals[m];
39475                 LDKSignature val_conv_12_ref;
39476                 CHECK(val_conv_12->arr_len == 64);
39477                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
39478                 val_constr.data[m] = val_conv_12_ref;
39479         }
39480         FREE(val);
39481         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
39482 }
39483
39484 uint64_t  __attribute__((export_name("TS_CommitmentSigned_new"))) TS_CommitmentSigned_new(int8_tArray channel_id_arg, int8_tArray signature_arg, ptrArray htlc_signatures_arg) {
39485         LDKThirtyTwoBytes channel_id_arg_ref;
39486         CHECK(channel_id_arg->arr_len == 32);
39487         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39488         LDKSignature signature_arg_ref;
39489         CHECK(signature_arg->arr_len == 64);
39490         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
39491         LDKCVec_SignatureZ htlc_signatures_arg_constr;
39492         htlc_signatures_arg_constr.datalen = htlc_signatures_arg->arr_len;
39493         if (htlc_signatures_arg_constr.datalen > 0)
39494                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
39495         else
39496                 htlc_signatures_arg_constr.data = NULL;
39497         int8_tArray* htlc_signatures_arg_vals = (void*) htlc_signatures_arg->elems;
39498         for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) {
39499                 int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m];
39500                 LDKSignature htlc_signatures_arg_conv_12_ref;
39501                 CHECK(htlc_signatures_arg_conv_12->arr_len == 64);
39502                 memcpy(htlc_signatures_arg_conv_12_ref.compact_form, htlc_signatures_arg_conv_12->elems, 64); FREE(htlc_signatures_arg_conv_12);
39503                 htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref;
39504         }
39505         FREE(htlc_signatures_arg);
39506         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
39507         uint64_t ret_ref = 0;
39508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39510         return ret_ref;
39511 }
39512
39513 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
39514         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
39515         uint64_t ret_ref = 0;
39516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39518         return ret_ref;
39519 }
39520 int64_t  __attribute__((export_name("TS_CommitmentSigned_clone_ptr"))) TS_CommitmentSigned_clone_ptr(uint64_t arg) {
39521         LDKCommitmentSigned arg_conv;
39522         arg_conv.inner = untag_ptr(arg);
39523         arg_conv.is_owned = ptr_is_owned(arg);
39524         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39525         arg_conv.is_owned = false;
39526         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
39527         return ret_conv;
39528 }
39529
39530 uint64_t  __attribute__((export_name("TS_CommitmentSigned_clone"))) TS_CommitmentSigned_clone(uint64_t orig) {
39531         LDKCommitmentSigned orig_conv;
39532         orig_conv.inner = untag_ptr(orig);
39533         orig_conv.is_owned = ptr_is_owned(orig);
39534         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39535         orig_conv.is_owned = false;
39536         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
39537         uint64_t ret_ref = 0;
39538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39540         return ret_ref;
39541 }
39542
39543 jboolean  __attribute__((export_name("TS_CommitmentSigned_eq"))) TS_CommitmentSigned_eq(uint64_t a, uint64_t b) {
39544         LDKCommitmentSigned a_conv;
39545         a_conv.inner = untag_ptr(a);
39546         a_conv.is_owned = ptr_is_owned(a);
39547         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39548         a_conv.is_owned = false;
39549         LDKCommitmentSigned b_conv;
39550         b_conv.inner = untag_ptr(b);
39551         b_conv.is_owned = ptr_is_owned(b);
39552         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39553         b_conv.is_owned = false;
39554         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
39555         return ret_conv;
39556 }
39557
39558 void  __attribute__((export_name("TS_RevokeAndACK_free"))) TS_RevokeAndACK_free(uint64_t this_obj) {
39559         LDKRevokeAndACK this_obj_conv;
39560         this_obj_conv.inner = untag_ptr(this_obj);
39561         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39563         RevokeAndACK_free(this_obj_conv);
39564 }
39565
39566 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_channel_id"))) TS_RevokeAndACK_get_channel_id(uint64_t this_ptr) {
39567         LDKRevokeAndACK this_ptr_conv;
39568         this_ptr_conv.inner = untag_ptr(this_ptr);
39569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39571         this_ptr_conv.is_owned = false;
39572         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39573         memcpy(ret_arr->elems, *RevokeAndACK_get_channel_id(&this_ptr_conv), 32);
39574         return ret_arr;
39575 }
39576
39577 void  __attribute__((export_name("TS_RevokeAndACK_set_channel_id"))) TS_RevokeAndACK_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39578         LDKRevokeAndACK this_ptr_conv;
39579         this_ptr_conv.inner = untag_ptr(this_ptr);
39580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39582         this_ptr_conv.is_owned = false;
39583         LDKThirtyTwoBytes val_ref;
39584         CHECK(val->arr_len == 32);
39585         memcpy(val_ref.data, val->elems, 32); FREE(val);
39586         RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
39587 }
39588
39589 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_per_commitment_secret"))) TS_RevokeAndACK_get_per_commitment_secret(uint64_t this_ptr) {
39590         LDKRevokeAndACK this_ptr_conv;
39591         this_ptr_conv.inner = untag_ptr(this_ptr);
39592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39594         this_ptr_conv.is_owned = false;
39595         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39596         memcpy(ret_arr->elems, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv), 32);
39597         return ret_arr;
39598 }
39599
39600 void  __attribute__((export_name("TS_RevokeAndACK_set_per_commitment_secret"))) TS_RevokeAndACK_set_per_commitment_secret(uint64_t this_ptr, int8_tArray val) {
39601         LDKRevokeAndACK this_ptr_conv;
39602         this_ptr_conv.inner = untag_ptr(this_ptr);
39603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39605         this_ptr_conv.is_owned = false;
39606         LDKThirtyTwoBytes val_ref;
39607         CHECK(val->arr_len == 32);
39608         memcpy(val_ref.data, val->elems, 32); FREE(val);
39609         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
39610 }
39611
39612 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_get_next_per_commitment_point"))) TS_RevokeAndACK_get_next_per_commitment_point(uint64_t this_ptr) {
39613         LDKRevokeAndACK this_ptr_conv;
39614         this_ptr_conv.inner = untag_ptr(this_ptr);
39615         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39617         this_ptr_conv.is_owned = false;
39618         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39619         memcpy(ret_arr->elems, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39620         return ret_arr;
39621 }
39622
39623 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) {
39624         LDKRevokeAndACK this_ptr_conv;
39625         this_ptr_conv.inner = untag_ptr(this_ptr);
39626         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39627         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39628         this_ptr_conv.is_owned = false;
39629         LDKPublicKey val_ref;
39630         CHECK(val->arr_len == 33);
39631         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39632         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
39633 }
39634
39635 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) {
39636         LDKThirtyTwoBytes channel_id_arg_ref;
39637         CHECK(channel_id_arg->arr_len == 32);
39638         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39639         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
39640         CHECK(per_commitment_secret_arg->arr_len == 32);
39641         memcpy(per_commitment_secret_arg_ref.data, per_commitment_secret_arg->elems, 32); FREE(per_commitment_secret_arg);
39642         LDKPublicKey next_per_commitment_point_arg_ref;
39643         CHECK(next_per_commitment_point_arg->arr_len == 33);
39644         memcpy(next_per_commitment_point_arg_ref.compressed_form, next_per_commitment_point_arg->elems, 33); FREE(next_per_commitment_point_arg);
39645         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
39646         uint64_t ret_ref = 0;
39647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39649         return ret_ref;
39650 }
39651
39652 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
39653         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
39654         uint64_t ret_ref = 0;
39655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39657         return ret_ref;
39658 }
39659 int64_t  __attribute__((export_name("TS_RevokeAndACK_clone_ptr"))) TS_RevokeAndACK_clone_ptr(uint64_t arg) {
39660         LDKRevokeAndACK arg_conv;
39661         arg_conv.inner = untag_ptr(arg);
39662         arg_conv.is_owned = ptr_is_owned(arg);
39663         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39664         arg_conv.is_owned = false;
39665         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
39666         return ret_conv;
39667 }
39668
39669 uint64_t  __attribute__((export_name("TS_RevokeAndACK_clone"))) TS_RevokeAndACK_clone(uint64_t orig) {
39670         LDKRevokeAndACK orig_conv;
39671         orig_conv.inner = untag_ptr(orig);
39672         orig_conv.is_owned = ptr_is_owned(orig);
39673         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39674         orig_conv.is_owned = false;
39675         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
39676         uint64_t ret_ref = 0;
39677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39679         return ret_ref;
39680 }
39681
39682 jboolean  __attribute__((export_name("TS_RevokeAndACK_eq"))) TS_RevokeAndACK_eq(uint64_t a, uint64_t b) {
39683         LDKRevokeAndACK a_conv;
39684         a_conv.inner = untag_ptr(a);
39685         a_conv.is_owned = ptr_is_owned(a);
39686         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39687         a_conv.is_owned = false;
39688         LDKRevokeAndACK b_conv;
39689         b_conv.inner = untag_ptr(b);
39690         b_conv.is_owned = ptr_is_owned(b);
39691         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39692         b_conv.is_owned = false;
39693         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
39694         return ret_conv;
39695 }
39696
39697 void  __attribute__((export_name("TS_UpdateFee_free"))) TS_UpdateFee_free(uint64_t this_obj) {
39698         LDKUpdateFee this_obj_conv;
39699         this_obj_conv.inner = untag_ptr(this_obj);
39700         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39702         UpdateFee_free(this_obj_conv);
39703 }
39704
39705 int8_tArray  __attribute__((export_name("TS_UpdateFee_get_channel_id"))) TS_UpdateFee_get_channel_id(uint64_t this_ptr) {
39706         LDKUpdateFee this_ptr_conv;
39707         this_ptr_conv.inner = untag_ptr(this_ptr);
39708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39710         this_ptr_conv.is_owned = false;
39711         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39712         memcpy(ret_arr->elems, *UpdateFee_get_channel_id(&this_ptr_conv), 32);
39713         return ret_arr;
39714 }
39715
39716 void  __attribute__((export_name("TS_UpdateFee_set_channel_id"))) TS_UpdateFee_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39717         LDKUpdateFee this_ptr_conv;
39718         this_ptr_conv.inner = untag_ptr(this_ptr);
39719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39721         this_ptr_conv.is_owned = false;
39722         LDKThirtyTwoBytes val_ref;
39723         CHECK(val->arr_len == 32);
39724         memcpy(val_ref.data, val->elems, 32); FREE(val);
39725         UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
39726 }
39727
39728 int32_t  __attribute__((export_name("TS_UpdateFee_get_feerate_per_kw"))) TS_UpdateFee_get_feerate_per_kw(uint64_t this_ptr) {
39729         LDKUpdateFee this_ptr_conv;
39730         this_ptr_conv.inner = untag_ptr(this_ptr);
39731         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39733         this_ptr_conv.is_owned = false;
39734         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
39735         return ret_conv;
39736 }
39737
39738 void  __attribute__((export_name("TS_UpdateFee_set_feerate_per_kw"))) TS_UpdateFee_set_feerate_per_kw(uint64_t this_ptr, int32_t val) {
39739         LDKUpdateFee this_ptr_conv;
39740         this_ptr_conv.inner = untag_ptr(this_ptr);
39741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39743         this_ptr_conv.is_owned = false;
39744         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
39745 }
39746
39747 uint64_t  __attribute__((export_name("TS_UpdateFee_new"))) TS_UpdateFee_new(int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
39748         LDKThirtyTwoBytes channel_id_arg_ref;
39749         CHECK(channel_id_arg->arr_len == 32);
39750         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39751         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
39752         uint64_t ret_ref = 0;
39753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39755         return ret_ref;
39756 }
39757
39758 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
39759         LDKUpdateFee ret_var = UpdateFee_clone(arg);
39760         uint64_t ret_ref = 0;
39761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39763         return ret_ref;
39764 }
39765 int64_t  __attribute__((export_name("TS_UpdateFee_clone_ptr"))) TS_UpdateFee_clone_ptr(uint64_t arg) {
39766         LDKUpdateFee arg_conv;
39767         arg_conv.inner = untag_ptr(arg);
39768         arg_conv.is_owned = ptr_is_owned(arg);
39769         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39770         arg_conv.is_owned = false;
39771         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
39772         return ret_conv;
39773 }
39774
39775 uint64_t  __attribute__((export_name("TS_UpdateFee_clone"))) TS_UpdateFee_clone(uint64_t orig) {
39776         LDKUpdateFee orig_conv;
39777         orig_conv.inner = untag_ptr(orig);
39778         orig_conv.is_owned = ptr_is_owned(orig);
39779         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39780         orig_conv.is_owned = false;
39781         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
39782         uint64_t ret_ref = 0;
39783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39785         return ret_ref;
39786 }
39787
39788 jboolean  __attribute__((export_name("TS_UpdateFee_eq"))) TS_UpdateFee_eq(uint64_t a, uint64_t b) {
39789         LDKUpdateFee a_conv;
39790         a_conv.inner = untag_ptr(a);
39791         a_conv.is_owned = ptr_is_owned(a);
39792         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39793         a_conv.is_owned = false;
39794         LDKUpdateFee b_conv;
39795         b_conv.inner = untag_ptr(b);
39796         b_conv.is_owned = ptr_is_owned(b);
39797         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39798         b_conv.is_owned = false;
39799         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
39800         return ret_conv;
39801 }
39802
39803 void  __attribute__((export_name("TS_ChannelReestablish_free"))) TS_ChannelReestablish_free(uint64_t this_obj) {
39804         LDKChannelReestablish this_obj_conv;
39805         this_obj_conv.inner = untag_ptr(this_obj);
39806         this_obj_conv.is_owned = ptr_is_owned(this_obj);
39807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
39808         ChannelReestablish_free(this_obj_conv);
39809 }
39810
39811 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_get_channel_id"))) TS_ChannelReestablish_get_channel_id(uint64_t this_ptr) {
39812         LDKChannelReestablish this_ptr_conv;
39813         this_ptr_conv.inner = untag_ptr(this_ptr);
39814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39816         this_ptr_conv.is_owned = false;
39817         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39818         memcpy(ret_arr->elems, *ChannelReestablish_get_channel_id(&this_ptr_conv), 32);
39819         return ret_arr;
39820 }
39821
39822 void  __attribute__((export_name("TS_ChannelReestablish_set_channel_id"))) TS_ChannelReestablish_set_channel_id(uint64_t this_ptr, int8_tArray val) {
39823         LDKChannelReestablish this_ptr_conv;
39824         this_ptr_conv.inner = untag_ptr(this_ptr);
39825         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39827         this_ptr_conv.is_owned = false;
39828         LDKThirtyTwoBytes val_ref;
39829         CHECK(val->arr_len == 32);
39830         memcpy(val_ref.data, val->elems, 32); FREE(val);
39831         ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
39832 }
39833
39834 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_local_commitment_number"))) TS_ChannelReestablish_get_next_local_commitment_number(uint64_t this_ptr) {
39835         LDKChannelReestablish this_ptr_conv;
39836         this_ptr_conv.inner = untag_ptr(this_ptr);
39837         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39838         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39839         this_ptr_conv.is_owned = false;
39840         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
39841         return ret_conv;
39842 }
39843
39844 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) {
39845         LDKChannelReestablish this_ptr_conv;
39846         this_ptr_conv.inner = untag_ptr(this_ptr);
39847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39849         this_ptr_conv.is_owned = false;
39850         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
39851 }
39852
39853 int64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_remote_commitment_number"))) TS_ChannelReestablish_get_next_remote_commitment_number(uint64_t this_ptr) {
39854         LDKChannelReestablish this_ptr_conv;
39855         this_ptr_conv.inner = untag_ptr(this_ptr);
39856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39858         this_ptr_conv.is_owned = false;
39859         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
39860         return ret_conv;
39861 }
39862
39863 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) {
39864         LDKChannelReestablish this_ptr_conv;
39865         this_ptr_conv.inner = untag_ptr(this_ptr);
39866         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39868         this_ptr_conv.is_owned = false;
39869         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
39870 }
39871
39872 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) {
39873         LDKChannelReestablish this_ptr_conv;
39874         this_ptr_conv.inner = untag_ptr(this_ptr);
39875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39877         this_ptr_conv.is_owned = false;
39878         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
39879         memcpy(ret_arr->elems, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv), 32);
39880         return ret_arr;
39881 }
39882
39883 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) {
39884         LDKChannelReestablish this_ptr_conv;
39885         this_ptr_conv.inner = untag_ptr(this_ptr);
39886         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39888         this_ptr_conv.is_owned = false;
39889         LDKThirtyTwoBytes val_ref;
39890         CHECK(val->arr_len == 32);
39891         memcpy(val_ref.data, val->elems, 32); FREE(val);
39892         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
39893 }
39894
39895 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) {
39896         LDKChannelReestablish this_ptr_conv;
39897         this_ptr_conv.inner = untag_ptr(this_ptr);
39898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39900         this_ptr_conv.is_owned = false;
39901         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
39902         memcpy(ret_arr->elems, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33);
39903         return ret_arr;
39904 }
39905
39906 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) {
39907         LDKChannelReestablish this_ptr_conv;
39908         this_ptr_conv.inner = untag_ptr(this_ptr);
39909         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39910         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39911         this_ptr_conv.is_owned = false;
39912         LDKPublicKey val_ref;
39913         CHECK(val->arr_len == 33);
39914         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
39915         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
39916 }
39917
39918 uint64_t  __attribute__((export_name("TS_ChannelReestablish_get_next_funding_txid"))) TS_ChannelReestablish_get_next_funding_txid(uint64_t this_ptr) {
39919         LDKChannelReestablish this_ptr_conv;
39920         this_ptr_conv.inner = untag_ptr(this_ptr);
39921         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39923         this_ptr_conv.is_owned = false;
39924         LDKCOption_TxidZ *ret_copy = MALLOC(sizeof(LDKCOption_TxidZ), "LDKCOption_TxidZ");
39925         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
39926         uint64_t ret_ref = tag_ptr(ret_copy, true);
39927         return ret_ref;
39928 }
39929
39930 void  __attribute__((export_name("TS_ChannelReestablish_set_next_funding_txid"))) TS_ChannelReestablish_set_next_funding_txid(uint64_t this_ptr, uint64_t val) {
39931         LDKChannelReestablish this_ptr_conv;
39932         this_ptr_conv.inner = untag_ptr(this_ptr);
39933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
39934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
39935         this_ptr_conv.is_owned = false;
39936         void* val_ptr = untag_ptr(val);
39937         CHECK_ACCESS(val_ptr);
39938         LDKCOption_TxidZ val_conv = *(LDKCOption_TxidZ*)(val_ptr);
39939         val_conv = COption_TxidZ_clone((LDKCOption_TxidZ*)untag_ptr(val));
39940         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
39941 }
39942
39943 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) {
39944         LDKThirtyTwoBytes channel_id_arg_ref;
39945         CHECK(channel_id_arg->arr_len == 32);
39946         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
39947         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
39948         CHECK(your_last_per_commitment_secret_arg->arr_len == 32);
39949         memcpy(your_last_per_commitment_secret_arg_ref.data, your_last_per_commitment_secret_arg->elems, 32); FREE(your_last_per_commitment_secret_arg);
39950         LDKPublicKey my_current_per_commitment_point_arg_ref;
39951         CHECK(my_current_per_commitment_point_arg->arr_len == 33);
39952         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);
39953         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
39954         CHECK_ACCESS(next_funding_txid_arg_ptr);
39955         LDKCOption_TxidZ next_funding_txid_arg_conv = *(LDKCOption_TxidZ*)(next_funding_txid_arg_ptr);
39956         next_funding_txid_arg_conv = COption_TxidZ_clone((LDKCOption_TxidZ*)untag_ptr(next_funding_txid_arg));
39957         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);
39958         uint64_t ret_ref = 0;
39959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39961         return ret_ref;
39962 }
39963
39964 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
39965         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
39966         uint64_t ret_ref = 0;
39967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39969         return ret_ref;
39970 }
39971 int64_t  __attribute__((export_name("TS_ChannelReestablish_clone_ptr"))) TS_ChannelReestablish_clone_ptr(uint64_t arg) {
39972         LDKChannelReestablish arg_conv;
39973         arg_conv.inner = untag_ptr(arg);
39974         arg_conv.is_owned = ptr_is_owned(arg);
39975         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
39976         arg_conv.is_owned = false;
39977         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
39978         return ret_conv;
39979 }
39980
39981 uint64_t  __attribute__((export_name("TS_ChannelReestablish_clone"))) TS_ChannelReestablish_clone(uint64_t orig) {
39982         LDKChannelReestablish orig_conv;
39983         orig_conv.inner = untag_ptr(orig);
39984         orig_conv.is_owned = ptr_is_owned(orig);
39985         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
39986         orig_conv.is_owned = false;
39987         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
39988         uint64_t ret_ref = 0;
39989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
39990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
39991         return ret_ref;
39992 }
39993
39994 jboolean  __attribute__((export_name("TS_ChannelReestablish_eq"))) TS_ChannelReestablish_eq(uint64_t a, uint64_t b) {
39995         LDKChannelReestablish a_conv;
39996         a_conv.inner = untag_ptr(a);
39997         a_conv.is_owned = ptr_is_owned(a);
39998         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
39999         a_conv.is_owned = false;
40000         LDKChannelReestablish b_conv;
40001         b_conv.inner = untag_ptr(b);
40002         b_conv.is_owned = ptr_is_owned(b);
40003         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40004         b_conv.is_owned = false;
40005         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
40006         return ret_conv;
40007 }
40008
40009 void  __attribute__((export_name("TS_AnnouncementSignatures_free"))) TS_AnnouncementSignatures_free(uint64_t this_obj) {
40010         LDKAnnouncementSignatures this_obj_conv;
40011         this_obj_conv.inner = untag_ptr(this_obj);
40012         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40014         AnnouncementSignatures_free(this_obj_conv);
40015 }
40016
40017 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_channel_id"))) TS_AnnouncementSignatures_get_channel_id(uint64_t this_ptr) {
40018         LDKAnnouncementSignatures this_ptr_conv;
40019         this_ptr_conv.inner = untag_ptr(this_ptr);
40020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40022         this_ptr_conv.is_owned = false;
40023         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40024         memcpy(ret_arr->elems, *AnnouncementSignatures_get_channel_id(&this_ptr_conv), 32);
40025         return ret_arr;
40026 }
40027
40028 void  __attribute__((export_name("TS_AnnouncementSignatures_set_channel_id"))) TS_AnnouncementSignatures_set_channel_id(uint64_t this_ptr, int8_tArray val) {
40029         LDKAnnouncementSignatures this_ptr_conv;
40030         this_ptr_conv.inner = untag_ptr(this_ptr);
40031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40033         this_ptr_conv.is_owned = false;
40034         LDKThirtyTwoBytes val_ref;
40035         CHECK(val->arr_len == 32);
40036         memcpy(val_ref.data, val->elems, 32); FREE(val);
40037         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
40038 }
40039
40040 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_get_short_channel_id"))) TS_AnnouncementSignatures_get_short_channel_id(uint64_t this_ptr) {
40041         LDKAnnouncementSignatures this_ptr_conv;
40042         this_ptr_conv.inner = untag_ptr(this_ptr);
40043         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40045         this_ptr_conv.is_owned = false;
40046         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
40047         return ret_conv;
40048 }
40049
40050 void  __attribute__((export_name("TS_AnnouncementSignatures_set_short_channel_id"))) TS_AnnouncementSignatures_set_short_channel_id(uint64_t this_ptr, int64_t val) {
40051         LDKAnnouncementSignatures this_ptr_conv;
40052         this_ptr_conv.inner = untag_ptr(this_ptr);
40053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40055         this_ptr_conv.is_owned = false;
40056         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
40057 }
40058
40059 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_node_signature"))) TS_AnnouncementSignatures_get_node_signature(uint64_t this_ptr) {
40060         LDKAnnouncementSignatures this_ptr_conv;
40061         this_ptr_conv.inner = untag_ptr(this_ptr);
40062         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40064         this_ptr_conv.is_owned = false;
40065         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40066         memcpy(ret_arr->elems, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64);
40067         return ret_arr;
40068 }
40069
40070 void  __attribute__((export_name("TS_AnnouncementSignatures_set_node_signature"))) TS_AnnouncementSignatures_set_node_signature(uint64_t this_ptr, int8_tArray val) {
40071         LDKAnnouncementSignatures this_ptr_conv;
40072         this_ptr_conv.inner = untag_ptr(this_ptr);
40073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40075         this_ptr_conv.is_owned = false;
40076         LDKSignature val_ref;
40077         CHECK(val->arr_len == 64);
40078         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40079         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
40080 }
40081
40082 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_get_bitcoin_signature"))) TS_AnnouncementSignatures_get_bitcoin_signature(uint64_t this_ptr) {
40083         LDKAnnouncementSignatures this_ptr_conv;
40084         this_ptr_conv.inner = untag_ptr(this_ptr);
40085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40087         this_ptr_conv.is_owned = false;
40088         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40089         memcpy(ret_arr->elems, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64);
40090         return ret_arr;
40091 }
40092
40093 void  __attribute__((export_name("TS_AnnouncementSignatures_set_bitcoin_signature"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint64_t this_ptr, int8_tArray val) {
40094         LDKAnnouncementSignatures this_ptr_conv;
40095         this_ptr_conv.inner = untag_ptr(this_ptr);
40096         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40097         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40098         this_ptr_conv.is_owned = false;
40099         LDKSignature val_ref;
40100         CHECK(val->arr_len == 64);
40101         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40102         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
40103 }
40104
40105 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) {
40106         LDKThirtyTwoBytes channel_id_arg_ref;
40107         CHECK(channel_id_arg->arr_len == 32);
40108         memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg);
40109         LDKSignature node_signature_arg_ref;
40110         CHECK(node_signature_arg->arr_len == 64);
40111         memcpy(node_signature_arg_ref.compact_form, node_signature_arg->elems, 64); FREE(node_signature_arg);
40112         LDKSignature bitcoin_signature_arg_ref;
40113         CHECK(bitcoin_signature_arg->arr_len == 64);
40114         memcpy(bitcoin_signature_arg_ref.compact_form, bitcoin_signature_arg->elems, 64); FREE(bitcoin_signature_arg);
40115         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
40116         uint64_t ret_ref = 0;
40117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40119         return ret_ref;
40120 }
40121
40122 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
40123         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
40124         uint64_t ret_ref = 0;
40125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40127         return ret_ref;
40128 }
40129 int64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone_ptr"))) TS_AnnouncementSignatures_clone_ptr(uint64_t arg) {
40130         LDKAnnouncementSignatures arg_conv;
40131         arg_conv.inner = untag_ptr(arg);
40132         arg_conv.is_owned = ptr_is_owned(arg);
40133         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40134         arg_conv.is_owned = false;
40135         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
40136         return ret_conv;
40137 }
40138
40139 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_clone"))) TS_AnnouncementSignatures_clone(uint64_t orig) {
40140         LDKAnnouncementSignatures orig_conv;
40141         orig_conv.inner = untag_ptr(orig);
40142         orig_conv.is_owned = ptr_is_owned(orig);
40143         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40144         orig_conv.is_owned = false;
40145         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
40146         uint64_t ret_ref = 0;
40147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40149         return ret_ref;
40150 }
40151
40152 jboolean  __attribute__((export_name("TS_AnnouncementSignatures_eq"))) TS_AnnouncementSignatures_eq(uint64_t a, uint64_t b) {
40153         LDKAnnouncementSignatures a_conv;
40154         a_conv.inner = untag_ptr(a);
40155         a_conv.is_owned = ptr_is_owned(a);
40156         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40157         a_conv.is_owned = false;
40158         LDKAnnouncementSignatures b_conv;
40159         b_conv.inner = untag_ptr(b);
40160         b_conv.is_owned = ptr_is_owned(b);
40161         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40162         b_conv.is_owned = false;
40163         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
40164         return ret_conv;
40165 }
40166
40167 void  __attribute__((export_name("TS_NetAddress_free"))) TS_NetAddress_free(uint64_t this_ptr) {
40168         if (!ptr_is_owned(this_ptr)) return;
40169         void* this_ptr_ptr = untag_ptr(this_ptr);
40170         CHECK_ACCESS(this_ptr_ptr);
40171         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(this_ptr_ptr);
40172         FREE(untag_ptr(this_ptr));
40173         NetAddress_free(this_ptr_conv);
40174 }
40175
40176 static inline uint64_t NetAddress_clone_ptr(LDKNetAddress *NONNULL_PTR arg) {
40177         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40178         *ret_copy = NetAddress_clone(arg);
40179         uint64_t ret_ref = tag_ptr(ret_copy, true);
40180         return ret_ref;
40181 }
40182 int64_t  __attribute__((export_name("TS_NetAddress_clone_ptr"))) TS_NetAddress_clone_ptr(uint64_t arg) {
40183         LDKNetAddress* arg_conv = (LDKNetAddress*)untag_ptr(arg);
40184         int64_t ret_conv = NetAddress_clone_ptr(arg_conv);
40185         return ret_conv;
40186 }
40187
40188 uint64_t  __attribute__((export_name("TS_NetAddress_clone"))) TS_NetAddress_clone(uint64_t orig) {
40189         LDKNetAddress* orig_conv = (LDKNetAddress*)untag_ptr(orig);
40190         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40191         *ret_copy = NetAddress_clone(orig_conv);
40192         uint64_t ret_ref = tag_ptr(ret_copy, true);
40193         return ret_ref;
40194 }
40195
40196 uint64_t  __attribute__((export_name("TS_NetAddress_ipv4"))) TS_NetAddress_ipv4(int8_tArray addr, int16_t port) {
40197         LDKFourBytes addr_ref;
40198         CHECK(addr->arr_len == 4);
40199         memcpy(addr_ref.data, addr->elems, 4); FREE(addr);
40200         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40201         *ret_copy = NetAddress_ipv4(addr_ref, port);
40202         uint64_t ret_ref = tag_ptr(ret_copy, true);
40203         return ret_ref;
40204 }
40205
40206 uint64_t  __attribute__((export_name("TS_NetAddress_ipv6"))) TS_NetAddress_ipv6(int8_tArray addr, int16_t port) {
40207         LDKSixteenBytes addr_ref;
40208         CHECK(addr->arr_len == 16);
40209         memcpy(addr_ref.data, addr->elems, 16); FREE(addr);
40210         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40211         *ret_copy = NetAddress_ipv6(addr_ref, port);
40212         uint64_t ret_ref = tag_ptr(ret_copy, true);
40213         return ret_ref;
40214 }
40215
40216 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v2"))) TS_NetAddress_onion_v2(int8_tArray a) {
40217         LDKTwelveBytes a_ref;
40218         CHECK(a->arr_len == 12);
40219         memcpy(a_ref.data, a->elems, 12); FREE(a);
40220         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40221         *ret_copy = NetAddress_onion_v2(a_ref);
40222         uint64_t ret_ref = tag_ptr(ret_copy, true);
40223         return ret_ref;
40224 }
40225
40226 uint64_t  __attribute__((export_name("TS_NetAddress_onion_v3"))) TS_NetAddress_onion_v3(int8_tArray ed25519_pubkey, int16_t checksum, int8_t version, int16_t port) {
40227         LDKThirtyTwoBytes ed25519_pubkey_ref;
40228         CHECK(ed25519_pubkey->arr_len == 32);
40229         memcpy(ed25519_pubkey_ref.data, ed25519_pubkey->elems, 32); FREE(ed25519_pubkey);
40230         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40231         *ret_copy = NetAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
40232         uint64_t ret_ref = tag_ptr(ret_copy, true);
40233         return ret_ref;
40234 }
40235
40236 uint64_t  __attribute__((export_name("TS_NetAddress_hostname"))) TS_NetAddress_hostname(uint64_t hostname, int16_t port) {
40237         LDKHostname hostname_conv;
40238         hostname_conv.inner = untag_ptr(hostname);
40239         hostname_conv.is_owned = ptr_is_owned(hostname);
40240         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
40241         hostname_conv = Hostname_clone(&hostname_conv);
40242         LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40243         *ret_copy = NetAddress_hostname(hostname_conv, port);
40244         uint64_t ret_ref = tag_ptr(ret_copy, true);
40245         return ret_ref;
40246 }
40247
40248 jboolean  __attribute__((export_name("TS_NetAddress_eq"))) TS_NetAddress_eq(uint64_t a, uint64_t b) {
40249         LDKNetAddress* a_conv = (LDKNetAddress*)untag_ptr(a);
40250         LDKNetAddress* b_conv = (LDKNetAddress*)untag_ptr(b);
40251         jboolean ret_conv = NetAddress_eq(a_conv, b_conv);
40252         return ret_conv;
40253 }
40254
40255 int8_tArray  __attribute__((export_name("TS_NetAddress_write"))) TS_NetAddress_write(uint64_t obj) {
40256         LDKNetAddress* obj_conv = (LDKNetAddress*)untag_ptr(obj);
40257         LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
40258         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40259         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40260         CVec_u8Z_free(ret_var);
40261         return ret_arr;
40262 }
40263
40264 uint64_t  __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read(int8_tArray ser) {
40265         LDKu8slice ser_ref;
40266         ser_ref.datalen = ser->arr_len;
40267         ser_ref.data = ser->elems;
40268         LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
40269         *ret_conv = NetAddress_read(ser_ref);
40270         FREE(ser);
40271         return tag_ptr(ret_conv, true);
40272 }
40273
40274 void  __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_free(uint64_t this_ptr) {
40275         if (!ptr_is_owned(this_ptr)) return;
40276         void* this_ptr_ptr = untag_ptr(this_ptr);
40277         CHECK_ACCESS(this_ptr_ptr);
40278         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
40279         FREE(untag_ptr(this_ptr));
40280         UnsignedGossipMessage_free(this_ptr_conv);
40281 }
40282
40283 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
40284         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40285         *ret_copy = UnsignedGossipMessage_clone(arg);
40286         uint64_t ret_ref = tag_ptr(ret_copy, true);
40287         return ret_ref;
40288 }
40289 int64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) {
40290         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
40291         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
40292         return ret_conv;
40293 }
40294
40295 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) {
40296         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
40297         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40298         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
40299         uint64_t ret_ref = tag_ptr(ret_copy, true);
40300         return ret_ref;
40301 }
40302
40303 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) {
40304         LDKUnsignedChannelAnnouncement a_conv;
40305         a_conv.inner = untag_ptr(a);
40306         a_conv.is_owned = ptr_is_owned(a);
40307         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40308         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
40309         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40310         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
40311         uint64_t ret_ref = tag_ptr(ret_copy, true);
40312         return ret_ref;
40313 }
40314
40315 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) {
40316         LDKUnsignedChannelUpdate a_conv;
40317         a_conv.inner = untag_ptr(a);
40318         a_conv.is_owned = ptr_is_owned(a);
40319         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40320         a_conv = UnsignedChannelUpdate_clone(&a_conv);
40321         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40322         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
40323         uint64_t ret_ref = tag_ptr(ret_copy, true);
40324         return ret_ref;
40325 }
40326
40327 uint64_t  __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) {
40328         LDKUnsignedNodeAnnouncement a_conv;
40329         a_conv.inner = untag_ptr(a);
40330         a_conv.is_owned = ptr_is_owned(a);
40331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40332         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
40333         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
40334         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
40335         uint64_t ret_ref = tag_ptr(ret_copy, true);
40336         return ret_ref;
40337 }
40338
40339 int8_tArray  __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) {
40340         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
40341         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
40342         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
40343         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
40344         CVec_u8Z_free(ret_var);
40345         return ret_arr;
40346 }
40347
40348 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) {
40349         LDKUnsignedNodeAnnouncement this_obj_conv;
40350         this_obj_conv.inner = untag_ptr(this_obj);
40351         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40353         UnsignedNodeAnnouncement_free(this_obj_conv);
40354 }
40355
40356 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_features"))) TS_UnsignedNodeAnnouncement_get_features(uint64_t this_ptr) {
40357         LDKUnsignedNodeAnnouncement this_ptr_conv;
40358         this_ptr_conv.inner = untag_ptr(this_ptr);
40359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40361         this_ptr_conv.is_owned = false;
40362         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
40363         uint64_t ret_ref = 0;
40364         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40365         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40366         return ret_ref;
40367 }
40368
40369 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_features"))) TS_UnsignedNodeAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
40370         LDKUnsignedNodeAnnouncement this_ptr_conv;
40371         this_ptr_conv.inner = untag_ptr(this_ptr);
40372         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40373         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40374         this_ptr_conv.is_owned = false;
40375         LDKNodeFeatures val_conv;
40376         val_conv.inner = untag_ptr(val);
40377         val_conv.is_owned = ptr_is_owned(val);
40378         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40379         val_conv = NodeFeatures_clone(&val_conv);
40380         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
40381 }
40382
40383 int32_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_timestamp"))) TS_UnsignedNodeAnnouncement_get_timestamp(uint64_t this_ptr) {
40384         LDKUnsignedNodeAnnouncement this_ptr_conv;
40385         this_ptr_conv.inner = untag_ptr(this_ptr);
40386         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40388         this_ptr_conv.is_owned = false;
40389         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
40390         return ret_conv;
40391 }
40392
40393 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) TS_UnsignedNodeAnnouncement_set_timestamp(uint64_t this_ptr, int32_t val) {
40394         LDKUnsignedNodeAnnouncement this_ptr_conv;
40395         this_ptr_conv.inner = untag_ptr(this_ptr);
40396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40398         this_ptr_conv.is_owned = false;
40399         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
40400 }
40401
40402 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) {
40403         LDKUnsignedNodeAnnouncement this_ptr_conv;
40404         this_ptr_conv.inner = untag_ptr(this_ptr);
40405         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40407         this_ptr_conv.is_owned = false;
40408         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
40409         uint64_t ret_ref = 0;
40410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40412         return ret_ref;
40413 }
40414
40415 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) {
40416         LDKUnsignedNodeAnnouncement this_ptr_conv;
40417         this_ptr_conv.inner = untag_ptr(this_ptr);
40418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40420         this_ptr_conv.is_owned = false;
40421         LDKNodeId val_conv;
40422         val_conv.inner = untag_ptr(val);
40423         val_conv.is_owned = ptr_is_owned(val);
40424         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40425         val_conv = NodeId_clone(&val_conv);
40426         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
40427 }
40428
40429 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) {
40430         LDKUnsignedNodeAnnouncement this_ptr_conv;
40431         this_ptr_conv.inner = untag_ptr(this_ptr);
40432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40434         this_ptr_conv.is_owned = false;
40435         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
40436         memcpy(ret_arr->elems, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv), 3);
40437         return ret_arr;
40438 }
40439
40440 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_rgb"))) TS_UnsignedNodeAnnouncement_set_rgb(uint64_t this_ptr, int8_tArray val) {
40441         LDKUnsignedNodeAnnouncement this_ptr_conv;
40442         this_ptr_conv.inner = untag_ptr(this_ptr);
40443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40445         this_ptr_conv.is_owned = false;
40446         LDKThreeBytes val_ref;
40447         CHECK(val->arr_len == 3);
40448         memcpy(val_ref.data, val->elems, 3); FREE(val);
40449         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
40450 }
40451
40452 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_alias"))) TS_UnsignedNodeAnnouncement_get_alias(uint64_t this_ptr) {
40453         LDKUnsignedNodeAnnouncement this_ptr_conv;
40454         this_ptr_conv.inner = untag_ptr(this_ptr);
40455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40457         this_ptr_conv.is_owned = false;
40458         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
40459         uint64_t ret_ref = 0;
40460         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40461         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40462         return ret_ref;
40463 }
40464
40465 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_alias"))) TS_UnsignedNodeAnnouncement_set_alias(uint64_t this_ptr, uint64_t val) {
40466         LDKUnsignedNodeAnnouncement this_ptr_conv;
40467         this_ptr_conv.inner = untag_ptr(this_ptr);
40468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40470         this_ptr_conv.is_owned = false;
40471         LDKNodeAlias val_conv;
40472         val_conv.inner = untag_ptr(val);
40473         val_conv.is_owned = ptr_is_owned(val);
40474         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40475         val_conv = NodeAlias_clone(&val_conv);
40476         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
40477 }
40478
40479 uint64_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_addresses"))) TS_UnsignedNodeAnnouncement_get_addresses(uint64_t this_ptr) {
40480         LDKUnsignedNodeAnnouncement 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_NetAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
40486         uint64_tArray ret_arr = NULL;
40487         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
40488         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
40489         for (size_t m = 0; m < ret_var.datalen; m++) {
40490                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
40491                 *ret_conv_12_copy = ret_var.data[m];
40492                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
40493                 ret_arr_ptr[m] = ret_conv_12_ref;
40494         }
40495         
40496         FREE(ret_var.data);
40497         return ret_arr;
40498 }
40499
40500 void  __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_addresses"))) TS_UnsignedNodeAnnouncement_set_addresses(uint64_t this_ptr, uint64_tArray val) {
40501         LDKUnsignedNodeAnnouncement this_ptr_conv;
40502         this_ptr_conv.inner = untag_ptr(this_ptr);
40503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40505         this_ptr_conv.is_owned = false;
40506         LDKCVec_NetAddressZ val_constr;
40507         val_constr.datalen = val->arr_len;
40508         if (val_constr.datalen > 0)
40509                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
40510         else
40511                 val_constr.data = NULL;
40512         uint64_t* val_vals = val->elems;
40513         for (size_t m = 0; m < val_constr.datalen; m++) {
40514                 uint64_t val_conv_12 = val_vals[m];
40515                 void* val_conv_12_ptr = untag_ptr(val_conv_12);
40516                 CHECK_ACCESS(val_conv_12_ptr);
40517                 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(val_conv_12_ptr);
40518                 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(val_conv_12));
40519                 val_constr.data[m] = val_conv_12_conv;
40520         }
40521         FREE(val);
40522         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
40523 }
40524
40525 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
40526         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
40527         uint64_t ret_ref = 0;
40528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40530         return ret_ref;
40531 }
40532 int64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone_ptr"))) TS_UnsignedNodeAnnouncement_clone_ptr(uint64_t arg) {
40533         LDKUnsignedNodeAnnouncement arg_conv;
40534         arg_conv.inner = untag_ptr(arg);
40535         arg_conv.is_owned = ptr_is_owned(arg);
40536         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40537         arg_conv.is_owned = false;
40538         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
40539         return ret_conv;
40540 }
40541
40542 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_clone"))) TS_UnsignedNodeAnnouncement_clone(uint64_t orig) {
40543         LDKUnsignedNodeAnnouncement orig_conv;
40544         orig_conv.inner = untag_ptr(orig);
40545         orig_conv.is_owned = ptr_is_owned(orig);
40546         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40547         orig_conv.is_owned = false;
40548         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
40549         uint64_t ret_ref = 0;
40550         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40551         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40552         return ret_ref;
40553 }
40554
40555 jboolean  __attribute__((export_name("TS_UnsignedNodeAnnouncement_eq"))) TS_UnsignedNodeAnnouncement_eq(uint64_t a, uint64_t b) {
40556         LDKUnsignedNodeAnnouncement a_conv;
40557         a_conv.inner = untag_ptr(a);
40558         a_conv.is_owned = ptr_is_owned(a);
40559         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40560         a_conv.is_owned = false;
40561         LDKUnsignedNodeAnnouncement b_conv;
40562         b_conv.inner = untag_ptr(b);
40563         b_conv.is_owned = ptr_is_owned(b);
40564         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40565         b_conv.is_owned = false;
40566         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
40567         return ret_conv;
40568 }
40569
40570 void  __attribute__((export_name("TS_NodeAnnouncement_free"))) TS_NodeAnnouncement_free(uint64_t this_obj) {
40571         LDKNodeAnnouncement this_obj_conv;
40572         this_obj_conv.inner = untag_ptr(this_obj);
40573         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40575         NodeAnnouncement_free(this_obj_conv);
40576 }
40577
40578 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_get_signature"))) TS_NodeAnnouncement_get_signature(uint64_t this_ptr) {
40579         LDKNodeAnnouncement this_ptr_conv;
40580         this_ptr_conv.inner = untag_ptr(this_ptr);
40581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40583         this_ptr_conv.is_owned = false;
40584         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40585         memcpy(ret_arr->elems, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64);
40586         return ret_arr;
40587 }
40588
40589 void  __attribute__((export_name("TS_NodeAnnouncement_set_signature"))) TS_NodeAnnouncement_set_signature(uint64_t this_ptr, int8_tArray val) {
40590         LDKNodeAnnouncement 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         LDKSignature val_ref;
40596         CHECK(val->arr_len == 64);
40597         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40598         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
40599 }
40600
40601 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_get_contents"))) TS_NodeAnnouncement_get_contents(uint64_t this_ptr) {
40602         LDKNodeAnnouncement this_ptr_conv;
40603         this_ptr_conv.inner = untag_ptr(this_ptr);
40604         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40605         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40606         this_ptr_conv.is_owned = false;
40607         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
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
40614 void  __attribute__((export_name("TS_NodeAnnouncement_set_contents"))) TS_NodeAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
40615         LDKNodeAnnouncement this_ptr_conv;
40616         this_ptr_conv.inner = untag_ptr(this_ptr);
40617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40619         this_ptr_conv.is_owned = false;
40620         LDKUnsignedNodeAnnouncement val_conv;
40621         val_conv.inner = untag_ptr(val);
40622         val_conv.is_owned = ptr_is_owned(val);
40623         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40624         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
40625         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
40626 }
40627
40628 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_new"))) TS_NodeAnnouncement_new(int8_tArray signature_arg, uint64_t contents_arg) {
40629         LDKSignature signature_arg_ref;
40630         CHECK(signature_arg->arr_len == 64);
40631         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
40632         LDKUnsignedNodeAnnouncement contents_arg_conv;
40633         contents_arg_conv.inner = untag_ptr(contents_arg);
40634         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
40635         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
40636         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
40637         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
40638         uint64_t ret_ref = 0;
40639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40641         return ret_ref;
40642 }
40643
40644 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
40645         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
40646         uint64_t ret_ref = 0;
40647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40649         return ret_ref;
40650 }
40651 int64_t  __attribute__((export_name("TS_NodeAnnouncement_clone_ptr"))) TS_NodeAnnouncement_clone_ptr(uint64_t arg) {
40652         LDKNodeAnnouncement arg_conv;
40653         arg_conv.inner = untag_ptr(arg);
40654         arg_conv.is_owned = ptr_is_owned(arg);
40655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40656         arg_conv.is_owned = false;
40657         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
40658         return ret_conv;
40659 }
40660
40661 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_clone"))) TS_NodeAnnouncement_clone(uint64_t orig) {
40662         LDKNodeAnnouncement orig_conv;
40663         orig_conv.inner = untag_ptr(orig);
40664         orig_conv.is_owned = ptr_is_owned(orig);
40665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40666         orig_conv.is_owned = false;
40667         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
40668         uint64_t ret_ref = 0;
40669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40671         return ret_ref;
40672 }
40673
40674 jboolean  __attribute__((export_name("TS_NodeAnnouncement_eq"))) TS_NodeAnnouncement_eq(uint64_t a, uint64_t b) {
40675         LDKNodeAnnouncement a_conv;
40676         a_conv.inner = untag_ptr(a);
40677         a_conv.is_owned = ptr_is_owned(a);
40678         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40679         a_conv.is_owned = false;
40680         LDKNodeAnnouncement b_conv;
40681         b_conv.inner = untag_ptr(b);
40682         b_conv.is_owned = ptr_is_owned(b);
40683         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40684         b_conv.is_owned = false;
40685         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
40686         return ret_conv;
40687 }
40688
40689 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_free"))) TS_UnsignedChannelAnnouncement_free(uint64_t this_obj) {
40690         LDKUnsignedChannelAnnouncement this_obj_conv;
40691         this_obj_conv.inner = untag_ptr(this_obj);
40692         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40694         UnsignedChannelAnnouncement_free(this_obj_conv);
40695 }
40696
40697 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_features"))) TS_UnsignedChannelAnnouncement_get_features(uint64_t this_ptr) {
40698         LDKUnsignedChannelAnnouncement this_ptr_conv;
40699         this_ptr_conv.inner = untag_ptr(this_ptr);
40700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40702         this_ptr_conv.is_owned = false;
40703         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
40704         uint64_t ret_ref = 0;
40705         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40706         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40707         return ret_ref;
40708 }
40709
40710 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_features"))) TS_UnsignedChannelAnnouncement_set_features(uint64_t this_ptr, uint64_t val) {
40711         LDKUnsignedChannelAnnouncement this_ptr_conv;
40712         this_ptr_conv.inner = untag_ptr(this_ptr);
40713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40715         this_ptr_conv.is_owned = false;
40716         LDKChannelFeatures val_conv;
40717         val_conv.inner = untag_ptr(val);
40718         val_conv.is_owned = ptr_is_owned(val);
40719         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40720         val_conv = ChannelFeatures_clone(&val_conv);
40721         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
40722 }
40723
40724 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_chain_hash"))) TS_UnsignedChannelAnnouncement_get_chain_hash(uint64_t this_ptr) {
40725         LDKUnsignedChannelAnnouncement 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
40731         memcpy(ret_arr->elems, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv), 32);
40732         return ret_arr;
40733 }
40734
40735 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_chain_hash"))) TS_UnsignedChannelAnnouncement_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
40736         LDKUnsignedChannelAnnouncement this_ptr_conv;
40737         this_ptr_conv.inner = untag_ptr(this_ptr);
40738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40740         this_ptr_conv.is_owned = false;
40741         LDKThirtyTwoBytes val_ref;
40742         CHECK(val->arr_len == 32);
40743         memcpy(val_ref.data, val->elems, 32); FREE(val);
40744         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
40745 }
40746
40747 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_short_channel_id"))) TS_UnsignedChannelAnnouncement_get_short_channel_id(uint64_t this_ptr) {
40748         LDKUnsignedChannelAnnouncement this_ptr_conv;
40749         this_ptr_conv.inner = untag_ptr(this_ptr);
40750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40752         this_ptr_conv.is_owned = false;
40753         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
40754         return ret_conv;
40755 }
40756
40757 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_channel_id"))) TS_UnsignedChannelAnnouncement_set_short_channel_id(uint64_t this_ptr, int64_t val) {
40758         LDKUnsignedChannelAnnouncement this_ptr_conv;
40759         this_ptr_conv.inner = untag_ptr(this_ptr);
40760         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40762         this_ptr_conv.is_owned = false;
40763         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
40764 }
40765
40766 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) {
40767         LDKUnsignedChannelAnnouncement this_ptr_conv;
40768         this_ptr_conv.inner = untag_ptr(this_ptr);
40769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40771         this_ptr_conv.is_owned = false;
40772         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
40773         uint64_t ret_ref = 0;
40774         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40775         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40776         return ret_ref;
40777 }
40778
40779 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) {
40780         LDKUnsignedChannelAnnouncement this_ptr_conv;
40781         this_ptr_conv.inner = untag_ptr(this_ptr);
40782         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40784         this_ptr_conv.is_owned = false;
40785         LDKNodeId val_conv;
40786         val_conv.inner = untag_ptr(val);
40787         val_conv.is_owned = ptr_is_owned(val);
40788         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40789         val_conv = NodeId_clone(&val_conv);
40790         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
40791 }
40792
40793 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) {
40794         LDKUnsignedChannelAnnouncement this_ptr_conv;
40795         this_ptr_conv.inner = untag_ptr(this_ptr);
40796         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40798         this_ptr_conv.is_owned = false;
40799         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
40800         uint64_t ret_ref = 0;
40801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40803         return ret_ref;
40804 }
40805
40806 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) {
40807         LDKUnsignedChannelAnnouncement this_ptr_conv;
40808         this_ptr_conv.inner = untag_ptr(this_ptr);
40809         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40810         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40811         this_ptr_conv.is_owned = false;
40812         LDKNodeId val_conv;
40813         val_conv.inner = untag_ptr(val);
40814         val_conv.is_owned = ptr_is_owned(val);
40815         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40816         val_conv = NodeId_clone(&val_conv);
40817         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
40818 }
40819
40820 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) {
40821         LDKUnsignedChannelAnnouncement this_ptr_conv;
40822         this_ptr_conv.inner = untag_ptr(this_ptr);
40823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40825         this_ptr_conv.is_owned = false;
40826         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
40827         uint64_t ret_ref = 0;
40828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40830         return ret_ref;
40831 }
40832
40833 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) {
40834         LDKUnsignedChannelAnnouncement this_ptr_conv;
40835         this_ptr_conv.inner = untag_ptr(this_ptr);
40836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40838         this_ptr_conv.is_owned = false;
40839         LDKNodeId val_conv;
40840         val_conv.inner = untag_ptr(val);
40841         val_conv.is_owned = ptr_is_owned(val);
40842         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40843         val_conv = NodeId_clone(&val_conv);
40844         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
40845 }
40846
40847 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) {
40848         LDKUnsignedChannelAnnouncement this_ptr_conv;
40849         this_ptr_conv.inner = untag_ptr(this_ptr);
40850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40852         this_ptr_conv.is_owned = false;
40853         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
40854         uint64_t ret_ref = 0;
40855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40857         return ret_ref;
40858 }
40859
40860 void  __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) {
40861         LDKUnsignedChannelAnnouncement this_ptr_conv;
40862         this_ptr_conv.inner = untag_ptr(this_ptr);
40863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40865         this_ptr_conv.is_owned = false;
40866         LDKNodeId val_conv;
40867         val_conv.inner = untag_ptr(val);
40868         val_conv.is_owned = ptr_is_owned(val);
40869         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
40870         val_conv = NodeId_clone(&val_conv);
40871         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
40872 }
40873
40874 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
40875         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
40876         uint64_t ret_ref = 0;
40877         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40878         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40879         return ret_ref;
40880 }
40881 int64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone_ptr"))) TS_UnsignedChannelAnnouncement_clone_ptr(uint64_t arg) {
40882         LDKUnsignedChannelAnnouncement arg_conv;
40883         arg_conv.inner = untag_ptr(arg);
40884         arg_conv.is_owned = ptr_is_owned(arg);
40885         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40886         arg_conv.is_owned = false;
40887         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
40888         return ret_conv;
40889 }
40890
40891 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_clone"))) TS_UnsignedChannelAnnouncement_clone(uint64_t orig) {
40892         LDKUnsignedChannelAnnouncement orig_conv;
40893         orig_conv.inner = untag_ptr(orig);
40894         orig_conv.is_owned = ptr_is_owned(orig);
40895         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40896         orig_conv.is_owned = false;
40897         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
40898         uint64_t ret_ref = 0;
40899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40901         return ret_ref;
40902 }
40903
40904 jboolean  __attribute__((export_name("TS_UnsignedChannelAnnouncement_eq"))) TS_UnsignedChannelAnnouncement_eq(uint64_t a, uint64_t b) {
40905         LDKUnsignedChannelAnnouncement a_conv;
40906         a_conv.inner = untag_ptr(a);
40907         a_conv.is_owned = ptr_is_owned(a);
40908         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40909         a_conv.is_owned = false;
40910         LDKUnsignedChannelAnnouncement b_conv;
40911         b_conv.inner = untag_ptr(b);
40912         b_conv.is_owned = ptr_is_owned(b);
40913         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40914         b_conv.is_owned = false;
40915         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
40916         return ret_conv;
40917 }
40918
40919 void  __attribute__((export_name("TS_ChannelAnnouncement_free"))) TS_ChannelAnnouncement_free(uint64_t this_obj) {
40920         LDKChannelAnnouncement this_obj_conv;
40921         this_obj_conv.inner = untag_ptr(this_obj);
40922         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40924         ChannelAnnouncement_free(this_obj_conv);
40925 }
40926
40927 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_1"))) TS_ChannelAnnouncement_get_node_signature_1(uint64_t this_ptr) {
40928         LDKChannelAnnouncement this_ptr_conv;
40929         this_ptr_conv.inner = untag_ptr(this_ptr);
40930         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40932         this_ptr_conv.is_owned = false;
40933         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40934         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64);
40935         return ret_arr;
40936 }
40937
40938 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_1"))) TS_ChannelAnnouncement_set_node_signature_1(uint64_t this_ptr, int8_tArray val) {
40939         LDKChannelAnnouncement 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         LDKSignature val_ref;
40945         CHECK(val->arr_len == 64);
40946         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40947         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
40948 }
40949
40950 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_node_signature_2"))) TS_ChannelAnnouncement_get_node_signature_2(uint64_t this_ptr) {
40951         LDKChannelAnnouncement this_ptr_conv;
40952         this_ptr_conv.inner = untag_ptr(this_ptr);
40953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40955         this_ptr_conv.is_owned = false;
40956         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40957         memcpy(ret_arr->elems, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64);
40958         return ret_arr;
40959 }
40960
40961 void  __attribute__((export_name("TS_ChannelAnnouncement_set_node_signature_2"))) TS_ChannelAnnouncement_set_node_signature_2(uint64_t this_ptr, int8_tArray val) {
40962         LDKChannelAnnouncement this_ptr_conv;
40963         this_ptr_conv.inner = untag_ptr(this_ptr);
40964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40966         this_ptr_conv.is_owned = false;
40967         LDKSignature val_ref;
40968         CHECK(val->arr_len == 64);
40969         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40970         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
40971 }
40972
40973 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_1"))) TS_ChannelAnnouncement_get_bitcoin_signature_1(uint64_t this_ptr) {
40974         LDKChannelAnnouncement this_ptr_conv;
40975         this_ptr_conv.inner = untag_ptr(this_ptr);
40976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40978         this_ptr_conv.is_owned = false;
40979         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
40980         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64);
40981         return ret_arr;
40982 }
40983
40984 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_1"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint64_t this_ptr, int8_tArray val) {
40985         LDKChannelAnnouncement this_ptr_conv;
40986         this_ptr_conv.inner = untag_ptr(this_ptr);
40987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40989         this_ptr_conv.is_owned = false;
40990         LDKSignature val_ref;
40991         CHECK(val->arr_len == 64);
40992         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
40993         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
40994 }
40995
40996 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_get_bitcoin_signature_2"))) TS_ChannelAnnouncement_get_bitcoin_signature_2(uint64_t this_ptr) {
40997         LDKChannelAnnouncement this_ptr_conv;
40998         this_ptr_conv.inner = untag_ptr(this_ptr);
40999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41001         this_ptr_conv.is_owned = false;
41002         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
41003         memcpy(ret_arr->elems, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64);
41004         return ret_arr;
41005 }
41006
41007 void  __attribute__((export_name("TS_ChannelAnnouncement_set_bitcoin_signature_2"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint64_t this_ptr, int8_tArray val) {
41008         LDKChannelAnnouncement this_ptr_conv;
41009         this_ptr_conv.inner = untag_ptr(this_ptr);
41010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41012         this_ptr_conv.is_owned = false;
41013         LDKSignature val_ref;
41014         CHECK(val->arr_len == 64);
41015         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
41016         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
41017 }
41018
41019 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_get_contents"))) TS_ChannelAnnouncement_get_contents(uint64_t this_ptr) {
41020         LDKChannelAnnouncement this_ptr_conv;
41021         this_ptr_conv.inner = untag_ptr(this_ptr);
41022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41024         this_ptr_conv.is_owned = false;
41025         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
41026         uint64_t ret_ref = 0;
41027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41029         return ret_ref;
41030 }
41031
41032 void  __attribute__((export_name("TS_ChannelAnnouncement_set_contents"))) TS_ChannelAnnouncement_set_contents(uint64_t this_ptr, uint64_t val) {
41033         LDKChannelAnnouncement this_ptr_conv;
41034         this_ptr_conv.inner = untag_ptr(this_ptr);
41035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41037         this_ptr_conv.is_owned = false;
41038         LDKUnsignedChannelAnnouncement val_conv;
41039         val_conv.inner = untag_ptr(val);
41040         val_conv.is_owned = ptr_is_owned(val);
41041         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41042         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
41043         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
41044 }
41045
41046 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) {
41047         LDKSignature node_signature_1_arg_ref;
41048         CHECK(node_signature_1_arg->arr_len == 64);
41049         memcpy(node_signature_1_arg_ref.compact_form, node_signature_1_arg->elems, 64); FREE(node_signature_1_arg);
41050         LDKSignature node_signature_2_arg_ref;
41051         CHECK(node_signature_2_arg->arr_len == 64);
41052         memcpy(node_signature_2_arg_ref.compact_form, node_signature_2_arg->elems, 64); FREE(node_signature_2_arg);
41053         LDKSignature bitcoin_signature_1_arg_ref;
41054         CHECK(bitcoin_signature_1_arg->arr_len == 64);
41055         memcpy(bitcoin_signature_1_arg_ref.compact_form, bitcoin_signature_1_arg->elems, 64); FREE(bitcoin_signature_1_arg);
41056         LDKSignature bitcoin_signature_2_arg_ref;
41057         CHECK(bitcoin_signature_2_arg->arr_len == 64);
41058         memcpy(bitcoin_signature_2_arg_ref.compact_form, bitcoin_signature_2_arg->elems, 64); FREE(bitcoin_signature_2_arg);
41059         LDKUnsignedChannelAnnouncement contents_arg_conv;
41060         contents_arg_conv.inner = untag_ptr(contents_arg);
41061         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
41062         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
41063         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
41064         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);
41065         uint64_t ret_ref = 0;
41066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41068         return ret_ref;
41069 }
41070
41071 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
41072         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
41073         uint64_t ret_ref = 0;
41074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41076         return ret_ref;
41077 }
41078 int64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone_ptr"))) TS_ChannelAnnouncement_clone_ptr(uint64_t arg) {
41079         LDKChannelAnnouncement arg_conv;
41080         arg_conv.inner = untag_ptr(arg);
41081         arg_conv.is_owned = ptr_is_owned(arg);
41082         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41083         arg_conv.is_owned = false;
41084         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
41085         return ret_conv;
41086 }
41087
41088 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_clone"))) TS_ChannelAnnouncement_clone(uint64_t orig) {
41089         LDKChannelAnnouncement orig_conv;
41090         orig_conv.inner = untag_ptr(orig);
41091         orig_conv.is_owned = ptr_is_owned(orig);
41092         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41093         orig_conv.is_owned = false;
41094         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
41095         uint64_t ret_ref = 0;
41096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41098         return ret_ref;
41099 }
41100
41101 jboolean  __attribute__((export_name("TS_ChannelAnnouncement_eq"))) TS_ChannelAnnouncement_eq(uint64_t a, uint64_t b) {
41102         LDKChannelAnnouncement a_conv;
41103         a_conv.inner = untag_ptr(a);
41104         a_conv.is_owned = ptr_is_owned(a);
41105         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41106         a_conv.is_owned = false;
41107         LDKChannelAnnouncement b_conv;
41108         b_conv.inner = untag_ptr(b);
41109         b_conv.is_owned = ptr_is_owned(b);
41110         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41111         b_conv.is_owned = false;
41112         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
41113         return ret_conv;
41114 }
41115
41116 void  __attribute__((export_name("TS_UnsignedChannelUpdate_free"))) TS_UnsignedChannelUpdate_free(uint64_t this_obj) {
41117         LDKUnsignedChannelUpdate this_obj_conv;
41118         this_obj_conv.inner = untag_ptr(this_obj);
41119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41121         UnsignedChannelUpdate_free(this_obj_conv);
41122 }
41123
41124 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_chain_hash"))) TS_UnsignedChannelUpdate_get_chain_hash(uint64_t this_ptr) {
41125         LDKUnsignedChannelUpdate this_ptr_conv;
41126         this_ptr_conv.inner = untag_ptr(this_ptr);
41127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41129         this_ptr_conv.is_owned = false;
41130         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41131         memcpy(ret_arr->elems, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv), 32);
41132         return ret_arr;
41133 }
41134
41135 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_chain_hash"))) TS_UnsignedChannelUpdate_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41136         LDKUnsignedChannelUpdate this_ptr_conv;
41137         this_ptr_conv.inner = untag_ptr(this_ptr);
41138         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41140         this_ptr_conv.is_owned = false;
41141         LDKThirtyTwoBytes val_ref;
41142         CHECK(val->arr_len == 32);
41143         memcpy(val_ref.data, val->elems, 32); FREE(val);
41144         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
41145 }
41146
41147 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_short_channel_id"))) TS_UnsignedChannelUpdate_get_short_channel_id(uint64_t this_ptr) {
41148         LDKUnsignedChannelUpdate this_ptr_conv;
41149         this_ptr_conv.inner = untag_ptr(this_ptr);
41150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41152         this_ptr_conv.is_owned = false;
41153         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
41154         return ret_conv;
41155 }
41156
41157 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_short_channel_id"))) TS_UnsignedChannelUpdate_set_short_channel_id(uint64_t this_ptr, int64_t val) {
41158         LDKUnsignedChannelUpdate this_ptr_conv;
41159         this_ptr_conv.inner = untag_ptr(this_ptr);
41160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41162         this_ptr_conv.is_owned = false;
41163         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
41164 }
41165
41166 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_timestamp"))) TS_UnsignedChannelUpdate_get_timestamp(uint64_t this_ptr) {
41167         LDKUnsignedChannelUpdate this_ptr_conv;
41168         this_ptr_conv.inner = untag_ptr(this_ptr);
41169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41171         this_ptr_conv.is_owned = false;
41172         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
41173         return ret_conv;
41174 }
41175
41176 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_timestamp"))) TS_UnsignedChannelUpdate_set_timestamp(uint64_t this_ptr, int32_t val) {
41177         LDKUnsignedChannelUpdate 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         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
41183 }
41184
41185 int8_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_flags"))) TS_UnsignedChannelUpdate_get_flags(uint64_t this_ptr) {
41186         LDKUnsignedChannelUpdate this_ptr_conv;
41187         this_ptr_conv.inner = untag_ptr(this_ptr);
41188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41190         this_ptr_conv.is_owned = false;
41191         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
41192         return ret_conv;
41193 }
41194
41195 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_flags"))) TS_UnsignedChannelUpdate_set_flags(uint64_t this_ptr, int8_t val) {
41196         LDKUnsignedChannelUpdate this_ptr_conv;
41197         this_ptr_conv.inner = untag_ptr(this_ptr);
41198         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41200         this_ptr_conv.is_owned = false;
41201         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
41202 }
41203
41204 int16_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_get_cltv_expiry_delta(uint64_t this_ptr) {
41205         LDKUnsignedChannelUpdate this_ptr_conv;
41206         this_ptr_conv.inner = untag_ptr(this_ptr);
41207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41209         this_ptr_conv.is_owned = false;
41210         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
41211         return ret_conv;
41212 }
41213
41214 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_cltv_expiry_delta"))) TS_UnsignedChannelUpdate_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
41215         LDKUnsignedChannelUpdate this_ptr_conv;
41216         this_ptr_conv.inner = untag_ptr(this_ptr);
41217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41219         this_ptr_conv.is_owned = false;
41220         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
41221 }
41222
41223 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_get_htlc_minimum_msat(uint64_t this_ptr) {
41224         LDKUnsignedChannelUpdate this_ptr_conv;
41225         this_ptr_conv.inner = untag_ptr(this_ptr);
41226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41228         this_ptr_conv.is_owned = false;
41229         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
41230         return ret_conv;
41231 }
41232
41233 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_minimum_msat"))) TS_UnsignedChannelUpdate_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
41234         LDKUnsignedChannelUpdate this_ptr_conv;
41235         this_ptr_conv.inner = untag_ptr(this_ptr);
41236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41238         this_ptr_conv.is_owned = false;
41239         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
41240 }
41241
41242 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_get_htlc_maximum_msat(uint64_t this_ptr) {
41243         LDKUnsignedChannelUpdate this_ptr_conv;
41244         this_ptr_conv.inner = untag_ptr(this_ptr);
41245         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41247         this_ptr_conv.is_owned = false;
41248         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
41249         return ret_conv;
41250 }
41251
41252 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_htlc_maximum_msat"))) TS_UnsignedChannelUpdate_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
41253         LDKUnsignedChannelUpdate this_ptr_conv;
41254         this_ptr_conv.inner = untag_ptr(this_ptr);
41255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41257         this_ptr_conv.is_owned = false;
41258         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
41259 }
41260
41261 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_base_msat"))) TS_UnsignedChannelUpdate_get_fee_base_msat(uint64_t this_ptr) {
41262         LDKUnsignedChannelUpdate this_ptr_conv;
41263         this_ptr_conv.inner = untag_ptr(this_ptr);
41264         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41266         this_ptr_conv.is_owned = false;
41267         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
41268         return ret_conv;
41269 }
41270
41271 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_base_msat"))) TS_UnsignedChannelUpdate_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
41272         LDKUnsignedChannelUpdate this_ptr_conv;
41273         this_ptr_conv.inner = untag_ptr(this_ptr);
41274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41276         this_ptr_conv.is_owned = false;
41277         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
41278 }
41279
41280 int32_t  __attribute__((export_name("TS_UnsignedChannelUpdate_get_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_get_fee_proportional_millionths(uint64_t this_ptr) {
41281         LDKUnsignedChannelUpdate this_ptr_conv;
41282         this_ptr_conv.inner = untag_ptr(this_ptr);
41283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41285         this_ptr_conv.is_owned = false;
41286         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
41287         return ret_conv;
41288 }
41289
41290 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_fee_proportional_millionths"))) TS_UnsignedChannelUpdate_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
41291         LDKUnsignedChannelUpdate this_ptr_conv;
41292         this_ptr_conv.inner = untag_ptr(this_ptr);
41293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41295         this_ptr_conv.is_owned = false;
41296         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
41297 }
41298
41299 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_get_excess_data"))) TS_UnsignedChannelUpdate_get_excess_data(uint64_t this_ptr) {
41300         LDKUnsignedChannelUpdate this_ptr_conv;
41301         this_ptr_conv.inner = untag_ptr(this_ptr);
41302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41304         this_ptr_conv.is_owned = false;
41305         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
41306         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
41307         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
41308         CVec_u8Z_free(ret_var);
41309         return ret_arr;
41310 }
41311
41312 void  __attribute__((export_name("TS_UnsignedChannelUpdate_set_excess_data"))) TS_UnsignedChannelUpdate_set_excess_data(uint64_t this_ptr, int8_tArray val) {
41313         LDKUnsignedChannelUpdate this_ptr_conv;
41314         this_ptr_conv.inner = untag_ptr(this_ptr);
41315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41317         this_ptr_conv.is_owned = false;
41318         LDKCVec_u8Z val_ref;
41319         val_ref.datalen = val->arr_len;
41320         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
41321         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
41322         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
41323 }
41324
41325 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) {
41326         LDKThirtyTwoBytes chain_hash_arg_ref;
41327         CHECK(chain_hash_arg->arr_len == 32);
41328         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41329         LDKCVec_u8Z excess_data_arg_ref;
41330         excess_data_arg_ref.datalen = excess_data_arg->arr_len;
41331         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
41332         memcpy(excess_data_arg_ref.data, excess_data_arg->elems, excess_data_arg_ref.datalen); FREE(excess_data_arg);
41333         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);
41334         uint64_t ret_ref = 0;
41335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41337         return ret_ref;
41338 }
41339
41340 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
41341         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
41342         uint64_t ret_ref = 0;
41343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41345         return ret_ref;
41346 }
41347 int64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone_ptr"))) TS_UnsignedChannelUpdate_clone_ptr(uint64_t arg) {
41348         LDKUnsignedChannelUpdate arg_conv;
41349         arg_conv.inner = untag_ptr(arg);
41350         arg_conv.is_owned = ptr_is_owned(arg);
41351         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41352         arg_conv.is_owned = false;
41353         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
41354         return ret_conv;
41355 }
41356
41357 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_clone"))) TS_UnsignedChannelUpdate_clone(uint64_t orig) {
41358         LDKUnsignedChannelUpdate orig_conv;
41359         orig_conv.inner = untag_ptr(orig);
41360         orig_conv.is_owned = ptr_is_owned(orig);
41361         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41362         orig_conv.is_owned = false;
41363         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
41364         uint64_t ret_ref = 0;
41365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41367         return ret_ref;
41368 }
41369
41370 jboolean  __attribute__((export_name("TS_UnsignedChannelUpdate_eq"))) TS_UnsignedChannelUpdate_eq(uint64_t a, uint64_t b) {
41371         LDKUnsignedChannelUpdate a_conv;
41372         a_conv.inner = untag_ptr(a);
41373         a_conv.is_owned = ptr_is_owned(a);
41374         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41375         a_conv.is_owned = false;
41376         LDKUnsignedChannelUpdate b_conv;
41377         b_conv.inner = untag_ptr(b);
41378         b_conv.is_owned = ptr_is_owned(b);
41379         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41380         b_conv.is_owned = false;
41381         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
41382         return ret_conv;
41383 }
41384
41385 void  __attribute__((export_name("TS_ChannelUpdate_free"))) TS_ChannelUpdate_free(uint64_t this_obj) {
41386         LDKChannelUpdate this_obj_conv;
41387         this_obj_conv.inner = untag_ptr(this_obj);
41388         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41390         ChannelUpdate_free(this_obj_conv);
41391 }
41392
41393 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_get_signature"))) TS_ChannelUpdate_get_signature(uint64_t this_ptr) {
41394         LDKChannelUpdate this_ptr_conv;
41395         this_ptr_conv.inner = untag_ptr(this_ptr);
41396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41398         this_ptr_conv.is_owned = false;
41399         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
41400         memcpy(ret_arr->elems, ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64);
41401         return ret_arr;
41402 }
41403
41404 void  __attribute__((export_name("TS_ChannelUpdate_set_signature"))) TS_ChannelUpdate_set_signature(uint64_t this_ptr, int8_tArray val) {
41405         LDKChannelUpdate this_ptr_conv;
41406         this_ptr_conv.inner = untag_ptr(this_ptr);
41407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41409         this_ptr_conv.is_owned = false;
41410         LDKSignature val_ref;
41411         CHECK(val->arr_len == 64);
41412         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
41413         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
41414 }
41415
41416 uint64_t  __attribute__((export_name("TS_ChannelUpdate_get_contents"))) TS_ChannelUpdate_get_contents(uint64_t this_ptr) {
41417         LDKChannelUpdate this_ptr_conv;
41418         this_ptr_conv.inner = untag_ptr(this_ptr);
41419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41421         this_ptr_conv.is_owned = false;
41422         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
41423         uint64_t ret_ref = 0;
41424         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41425         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41426         return ret_ref;
41427 }
41428
41429 void  __attribute__((export_name("TS_ChannelUpdate_set_contents"))) TS_ChannelUpdate_set_contents(uint64_t this_ptr, uint64_t val) {
41430         LDKChannelUpdate this_ptr_conv;
41431         this_ptr_conv.inner = untag_ptr(this_ptr);
41432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41434         this_ptr_conv.is_owned = false;
41435         LDKUnsignedChannelUpdate val_conv;
41436         val_conv.inner = untag_ptr(val);
41437         val_conv.is_owned = ptr_is_owned(val);
41438         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41439         val_conv = UnsignedChannelUpdate_clone(&val_conv);
41440         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
41441 }
41442
41443 uint64_t  __attribute__((export_name("TS_ChannelUpdate_new"))) TS_ChannelUpdate_new(int8_tArray signature_arg, uint64_t contents_arg) {
41444         LDKSignature signature_arg_ref;
41445         CHECK(signature_arg->arr_len == 64);
41446         memcpy(signature_arg_ref.compact_form, signature_arg->elems, 64); FREE(signature_arg);
41447         LDKUnsignedChannelUpdate contents_arg_conv;
41448         contents_arg_conv.inner = untag_ptr(contents_arg);
41449         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
41450         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
41451         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
41452         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
41453         uint64_t ret_ref = 0;
41454         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41455         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41456         return ret_ref;
41457 }
41458
41459 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
41460         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
41461         uint64_t ret_ref = 0;
41462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41464         return ret_ref;
41465 }
41466 int64_t  __attribute__((export_name("TS_ChannelUpdate_clone_ptr"))) TS_ChannelUpdate_clone_ptr(uint64_t arg) {
41467         LDKChannelUpdate arg_conv;
41468         arg_conv.inner = untag_ptr(arg);
41469         arg_conv.is_owned = ptr_is_owned(arg);
41470         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41471         arg_conv.is_owned = false;
41472         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
41473         return ret_conv;
41474 }
41475
41476 uint64_t  __attribute__((export_name("TS_ChannelUpdate_clone"))) TS_ChannelUpdate_clone(uint64_t orig) {
41477         LDKChannelUpdate orig_conv;
41478         orig_conv.inner = untag_ptr(orig);
41479         orig_conv.is_owned = ptr_is_owned(orig);
41480         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41481         orig_conv.is_owned = false;
41482         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
41483         uint64_t ret_ref = 0;
41484         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41485         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41486         return ret_ref;
41487 }
41488
41489 jboolean  __attribute__((export_name("TS_ChannelUpdate_eq"))) TS_ChannelUpdate_eq(uint64_t a, uint64_t b) {
41490         LDKChannelUpdate a_conv;
41491         a_conv.inner = untag_ptr(a);
41492         a_conv.is_owned = ptr_is_owned(a);
41493         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41494         a_conv.is_owned = false;
41495         LDKChannelUpdate b_conv;
41496         b_conv.inner = untag_ptr(b);
41497         b_conv.is_owned = ptr_is_owned(b);
41498         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41499         b_conv.is_owned = false;
41500         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
41501         return ret_conv;
41502 }
41503
41504 void  __attribute__((export_name("TS_QueryChannelRange_free"))) TS_QueryChannelRange_free(uint64_t this_obj) {
41505         LDKQueryChannelRange this_obj_conv;
41506         this_obj_conv.inner = untag_ptr(this_obj);
41507         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41509         QueryChannelRange_free(this_obj_conv);
41510 }
41511
41512 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_get_chain_hash"))) TS_QueryChannelRange_get_chain_hash(uint64_t this_ptr) {
41513         LDKQueryChannelRange this_ptr_conv;
41514         this_ptr_conv.inner = untag_ptr(this_ptr);
41515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41517         this_ptr_conv.is_owned = false;
41518         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41519         memcpy(ret_arr->elems, *QueryChannelRange_get_chain_hash(&this_ptr_conv), 32);
41520         return ret_arr;
41521 }
41522
41523 void  __attribute__((export_name("TS_QueryChannelRange_set_chain_hash"))) TS_QueryChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41524         LDKQueryChannelRange this_ptr_conv;
41525         this_ptr_conv.inner = untag_ptr(this_ptr);
41526         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41528         this_ptr_conv.is_owned = false;
41529         LDKThirtyTwoBytes val_ref;
41530         CHECK(val->arr_len == 32);
41531         memcpy(val_ref.data, val->elems, 32); FREE(val);
41532         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
41533 }
41534
41535 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_first_blocknum"))) TS_QueryChannelRange_get_first_blocknum(uint64_t this_ptr) {
41536         LDKQueryChannelRange this_ptr_conv;
41537         this_ptr_conv.inner = untag_ptr(this_ptr);
41538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41540         this_ptr_conv.is_owned = false;
41541         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
41542         return ret_conv;
41543 }
41544
41545 void  __attribute__((export_name("TS_QueryChannelRange_set_first_blocknum"))) TS_QueryChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
41546         LDKQueryChannelRange this_ptr_conv;
41547         this_ptr_conv.inner = untag_ptr(this_ptr);
41548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41550         this_ptr_conv.is_owned = false;
41551         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
41552 }
41553
41554 int32_t  __attribute__((export_name("TS_QueryChannelRange_get_number_of_blocks"))) TS_QueryChannelRange_get_number_of_blocks(uint64_t this_ptr) {
41555         LDKQueryChannelRange this_ptr_conv;
41556         this_ptr_conv.inner = untag_ptr(this_ptr);
41557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41559         this_ptr_conv.is_owned = false;
41560         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
41561         return ret_conv;
41562 }
41563
41564 void  __attribute__((export_name("TS_QueryChannelRange_set_number_of_blocks"))) TS_QueryChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
41565         LDKQueryChannelRange this_ptr_conv;
41566         this_ptr_conv.inner = untag_ptr(this_ptr);
41567         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41568         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41569         this_ptr_conv.is_owned = false;
41570         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
41571 }
41572
41573 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) {
41574         LDKThirtyTwoBytes chain_hash_arg_ref;
41575         CHECK(chain_hash_arg->arr_len == 32);
41576         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41577         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
41578         uint64_t ret_ref = 0;
41579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41581         return ret_ref;
41582 }
41583
41584 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
41585         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
41586         uint64_t ret_ref = 0;
41587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41589         return ret_ref;
41590 }
41591 int64_t  __attribute__((export_name("TS_QueryChannelRange_clone_ptr"))) TS_QueryChannelRange_clone_ptr(uint64_t arg) {
41592         LDKQueryChannelRange arg_conv;
41593         arg_conv.inner = untag_ptr(arg);
41594         arg_conv.is_owned = ptr_is_owned(arg);
41595         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41596         arg_conv.is_owned = false;
41597         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
41598         return ret_conv;
41599 }
41600
41601 uint64_t  __attribute__((export_name("TS_QueryChannelRange_clone"))) TS_QueryChannelRange_clone(uint64_t orig) {
41602         LDKQueryChannelRange orig_conv;
41603         orig_conv.inner = untag_ptr(orig);
41604         orig_conv.is_owned = ptr_is_owned(orig);
41605         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41606         orig_conv.is_owned = false;
41607         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
41608         uint64_t ret_ref = 0;
41609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41611         return ret_ref;
41612 }
41613
41614 jboolean  __attribute__((export_name("TS_QueryChannelRange_eq"))) TS_QueryChannelRange_eq(uint64_t a, uint64_t b) {
41615         LDKQueryChannelRange a_conv;
41616         a_conv.inner = untag_ptr(a);
41617         a_conv.is_owned = ptr_is_owned(a);
41618         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41619         a_conv.is_owned = false;
41620         LDKQueryChannelRange b_conv;
41621         b_conv.inner = untag_ptr(b);
41622         b_conv.is_owned = ptr_is_owned(b);
41623         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41624         b_conv.is_owned = false;
41625         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
41626         return ret_conv;
41627 }
41628
41629 void  __attribute__((export_name("TS_ReplyChannelRange_free"))) TS_ReplyChannelRange_free(uint64_t this_obj) {
41630         LDKReplyChannelRange this_obj_conv;
41631         this_obj_conv.inner = untag_ptr(this_obj);
41632         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41634         ReplyChannelRange_free(this_obj_conv);
41635 }
41636
41637 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_chain_hash"))) TS_ReplyChannelRange_get_chain_hash(uint64_t this_ptr) {
41638         LDKReplyChannelRange this_ptr_conv;
41639         this_ptr_conv.inner = untag_ptr(this_ptr);
41640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41642         this_ptr_conv.is_owned = false;
41643         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41644         memcpy(ret_arr->elems, *ReplyChannelRange_get_chain_hash(&this_ptr_conv), 32);
41645         return ret_arr;
41646 }
41647
41648 void  __attribute__((export_name("TS_ReplyChannelRange_set_chain_hash"))) TS_ReplyChannelRange_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41649         LDKReplyChannelRange this_ptr_conv;
41650         this_ptr_conv.inner = untag_ptr(this_ptr);
41651         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41653         this_ptr_conv.is_owned = false;
41654         LDKThirtyTwoBytes val_ref;
41655         CHECK(val->arr_len == 32);
41656         memcpy(val_ref.data, val->elems, 32); FREE(val);
41657         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
41658 }
41659
41660 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_first_blocknum"))) TS_ReplyChannelRange_get_first_blocknum(uint64_t this_ptr) {
41661         LDKReplyChannelRange this_ptr_conv;
41662         this_ptr_conv.inner = untag_ptr(this_ptr);
41663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41665         this_ptr_conv.is_owned = false;
41666         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
41667         return ret_conv;
41668 }
41669
41670 void  __attribute__((export_name("TS_ReplyChannelRange_set_first_blocknum"))) TS_ReplyChannelRange_set_first_blocknum(uint64_t this_ptr, int32_t val) {
41671         LDKReplyChannelRange 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         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
41677 }
41678
41679 int32_t  __attribute__((export_name("TS_ReplyChannelRange_get_number_of_blocks"))) TS_ReplyChannelRange_get_number_of_blocks(uint64_t this_ptr) {
41680         LDKReplyChannelRange this_ptr_conv;
41681         this_ptr_conv.inner = untag_ptr(this_ptr);
41682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41684         this_ptr_conv.is_owned = false;
41685         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
41686         return ret_conv;
41687 }
41688
41689 void  __attribute__((export_name("TS_ReplyChannelRange_set_number_of_blocks"))) TS_ReplyChannelRange_set_number_of_blocks(uint64_t this_ptr, int32_t val) {
41690         LDKReplyChannelRange this_ptr_conv;
41691         this_ptr_conv.inner = untag_ptr(this_ptr);
41692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41694         this_ptr_conv.is_owned = false;
41695         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
41696 }
41697
41698 jboolean  __attribute__((export_name("TS_ReplyChannelRange_get_sync_complete"))) TS_ReplyChannelRange_get_sync_complete(uint64_t this_ptr) {
41699         LDKReplyChannelRange this_ptr_conv;
41700         this_ptr_conv.inner = untag_ptr(this_ptr);
41701         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41703         this_ptr_conv.is_owned = false;
41704         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
41705         return ret_conv;
41706 }
41707
41708 void  __attribute__((export_name("TS_ReplyChannelRange_set_sync_complete"))) TS_ReplyChannelRange_set_sync_complete(uint64_t this_ptr, jboolean val) {
41709         LDKReplyChannelRange this_ptr_conv;
41710         this_ptr_conv.inner = untag_ptr(this_ptr);
41711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41713         this_ptr_conv.is_owned = false;
41714         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
41715 }
41716
41717 int64_tArray  __attribute__((export_name("TS_ReplyChannelRange_get_short_channel_ids"))) TS_ReplyChannelRange_get_short_channel_ids(uint64_t this_ptr) {
41718         LDKReplyChannelRange this_ptr_conv;
41719         this_ptr_conv.inner = untag_ptr(this_ptr);
41720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41722         this_ptr_conv.is_owned = false;
41723         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
41724         int64_tArray ret_arr = NULL;
41725         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41726         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41727         for (size_t i = 0; i < ret_var.datalen; i++) {
41728                 int64_t ret_conv_8_conv = ret_var.data[i];
41729                 ret_arr_ptr[i] = ret_conv_8_conv;
41730         }
41731         
41732         FREE(ret_var.data);
41733         return ret_arr;
41734 }
41735
41736 void  __attribute__((export_name("TS_ReplyChannelRange_set_short_channel_ids"))) TS_ReplyChannelRange_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
41737         LDKReplyChannelRange this_ptr_conv;
41738         this_ptr_conv.inner = untag_ptr(this_ptr);
41739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41741         this_ptr_conv.is_owned = false;
41742         LDKCVec_u64Z val_constr;
41743         val_constr.datalen = val->arr_len;
41744         if (val_constr.datalen > 0)
41745                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41746         else
41747                 val_constr.data = NULL;
41748         int64_t* val_vals = val->elems;
41749         for (size_t i = 0; i < val_constr.datalen; i++) {
41750                 int64_t val_conv_8 = val_vals[i];
41751                 val_constr.data[i] = val_conv_8;
41752         }
41753         FREE(val);
41754         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
41755 }
41756
41757 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) {
41758         LDKThirtyTwoBytes chain_hash_arg_ref;
41759         CHECK(chain_hash_arg->arr_len == 32);
41760         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41761         LDKCVec_u64Z short_channel_ids_arg_constr;
41762         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
41763         if (short_channel_ids_arg_constr.datalen > 0)
41764                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41765         else
41766                 short_channel_ids_arg_constr.data = NULL;
41767         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
41768         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
41769                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
41770                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
41771         }
41772         FREE(short_channel_ids_arg);
41773         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
41774         uint64_t ret_ref = 0;
41775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41777         return ret_ref;
41778 }
41779
41780 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
41781         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
41782         uint64_t ret_ref = 0;
41783         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41784         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41785         return ret_ref;
41786 }
41787 int64_t  __attribute__((export_name("TS_ReplyChannelRange_clone_ptr"))) TS_ReplyChannelRange_clone_ptr(uint64_t arg) {
41788         LDKReplyChannelRange arg_conv;
41789         arg_conv.inner = untag_ptr(arg);
41790         arg_conv.is_owned = ptr_is_owned(arg);
41791         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41792         arg_conv.is_owned = false;
41793         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
41794         return ret_conv;
41795 }
41796
41797 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_clone"))) TS_ReplyChannelRange_clone(uint64_t orig) {
41798         LDKReplyChannelRange orig_conv;
41799         orig_conv.inner = untag_ptr(orig);
41800         orig_conv.is_owned = ptr_is_owned(orig);
41801         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41802         orig_conv.is_owned = false;
41803         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
41804         uint64_t ret_ref = 0;
41805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41807         return ret_ref;
41808 }
41809
41810 jboolean  __attribute__((export_name("TS_ReplyChannelRange_eq"))) TS_ReplyChannelRange_eq(uint64_t a, uint64_t b) {
41811         LDKReplyChannelRange a_conv;
41812         a_conv.inner = untag_ptr(a);
41813         a_conv.is_owned = ptr_is_owned(a);
41814         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41815         a_conv.is_owned = false;
41816         LDKReplyChannelRange b_conv;
41817         b_conv.inner = untag_ptr(b);
41818         b_conv.is_owned = ptr_is_owned(b);
41819         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41820         b_conv.is_owned = false;
41821         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
41822         return ret_conv;
41823 }
41824
41825 void  __attribute__((export_name("TS_QueryShortChannelIds_free"))) TS_QueryShortChannelIds_free(uint64_t this_obj) {
41826         LDKQueryShortChannelIds this_obj_conv;
41827         this_obj_conv.inner = untag_ptr(this_obj);
41828         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41830         QueryShortChannelIds_free(this_obj_conv);
41831 }
41832
41833 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_chain_hash"))) TS_QueryShortChannelIds_get_chain_hash(uint64_t this_ptr) {
41834         LDKQueryShortChannelIds this_ptr_conv;
41835         this_ptr_conv.inner = untag_ptr(this_ptr);
41836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41838         this_ptr_conv.is_owned = false;
41839         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41840         memcpy(ret_arr->elems, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv), 32);
41841         return ret_arr;
41842 }
41843
41844 void  __attribute__((export_name("TS_QueryShortChannelIds_set_chain_hash"))) TS_QueryShortChannelIds_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41845         LDKQueryShortChannelIds this_ptr_conv;
41846         this_ptr_conv.inner = untag_ptr(this_ptr);
41847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41849         this_ptr_conv.is_owned = false;
41850         LDKThirtyTwoBytes val_ref;
41851         CHECK(val->arr_len == 32);
41852         memcpy(val_ref.data, val->elems, 32); FREE(val);
41853         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
41854 }
41855
41856 int64_tArray  __attribute__((export_name("TS_QueryShortChannelIds_get_short_channel_ids"))) TS_QueryShortChannelIds_get_short_channel_ids(uint64_t this_ptr) {
41857         LDKQueryShortChannelIds this_ptr_conv;
41858         this_ptr_conv.inner = untag_ptr(this_ptr);
41859         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41861         this_ptr_conv.is_owned = false;
41862         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
41863         int64_tArray ret_arr = NULL;
41864         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
41865         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
41866         for (size_t i = 0; i < ret_var.datalen; i++) {
41867                 int64_t ret_conv_8_conv = ret_var.data[i];
41868                 ret_arr_ptr[i] = ret_conv_8_conv;
41869         }
41870         
41871         FREE(ret_var.data);
41872         return ret_arr;
41873 }
41874
41875 void  __attribute__((export_name("TS_QueryShortChannelIds_set_short_channel_ids"))) TS_QueryShortChannelIds_set_short_channel_ids(uint64_t this_ptr, int64_tArray val) {
41876         LDKQueryShortChannelIds this_ptr_conv;
41877         this_ptr_conv.inner = untag_ptr(this_ptr);
41878         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41880         this_ptr_conv.is_owned = false;
41881         LDKCVec_u64Z val_constr;
41882         val_constr.datalen = val->arr_len;
41883         if (val_constr.datalen > 0)
41884                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41885         else
41886                 val_constr.data = NULL;
41887         int64_t* val_vals = val->elems;
41888         for (size_t i = 0; i < val_constr.datalen; i++) {
41889                 int64_t val_conv_8 = val_vals[i];
41890                 val_constr.data[i] = val_conv_8;
41891         }
41892         FREE(val);
41893         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
41894 }
41895
41896 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_new"))) TS_QueryShortChannelIds_new(int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
41897         LDKThirtyTwoBytes chain_hash_arg_ref;
41898         CHECK(chain_hash_arg->arr_len == 32);
41899         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
41900         LDKCVec_u64Z short_channel_ids_arg_constr;
41901         short_channel_ids_arg_constr.datalen = short_channel_ids_arg->arr_len;
41902         if (short_channel_ids_arg_constr.datalen > 0)
41903                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
41904         else
41905                 short_channel_ids_arg_constr.data = NULL;
41906         int64_t* short_channel_ids_arg_vals = short_channel_ids_arg->elems;
41907         for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) {
41908                 int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i];
41909                 short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8;
41910         }
41911         FREE(short_channel_ids_arg);
41912         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
41913         uint64_t ret_ref = 0;
41914         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41915         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41916         return ret_ref;
41917 }
41918
41919 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
41920         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
41921         uint64_t ret_ref = 0;
41922         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41923         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41924         return ret_ref;
41925 }
41926 int64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone_ptr"))) TS_QueryShortChannelIds_clone_ptr(uint64_t arg) {
41927         LDKQueryShortChannelIds arg_conv;
41928         arg_conv.inner = untag_ptr(arg);
41929         arg_conv.is_owned = ptr_is_owned(arg);
41930         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41931         arg_conv.is_owned = false;
41932         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
41933         return ret_conv;
41934 }
41935
41936 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_clone"))) TS_QueryShortChannelIds_clone(uint64_t orig) {
41937         LDKQueryShortChannelIds orig_conv;
41938         orig_conv.inner = untag_ptr(orig);
41939         orig_conv.is_owned = ptr_is_owned(orig);
41940         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41941         orig_conv.is_owned = false;
41942         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
41943         uint64_t ret_ref = 0;
41944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41946         return ret_ref;
41947 }
41948
41949 jboolean  __attribute__((export_name("TS_QueryShortChannelIds_eq"))) TS_QueryShortChannelIds_eq(uint64_t a, uint64_t b) {
41950         LDKQueryShortChannelIds a_conv;
41951         a_conv.inner = untag_ptr(a);
41952         a_conv.is_owned = ptr_is_owned(a);
41953         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41954         a_conv.is_owned = false;
41955         LDKQueryShortChannelIds b_conv;
41956         b_conv.inner = untag_ptr(b);
41957         b_conv.is_owned = ptr_is_owned(b);
41958         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41959         b_conv.is_owned = false;
41960         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
41961         return ret_conv;
41962 }
41963
41964 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_free"))) TS_ReplyShortChannelIdsEnd_free(uint64_t this_obj) {
41965         LDKReplyShortChannelIdsEnd this_obj_conv;
41966         this_obj_conv.inner = untag_ptr(this_obj);
41967         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41969         ReplyShortChannelIdsEnd_free(this_obj_conv);
41970 }
41971
41972 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_chain_hash"))) TS_ReplyShortChannelIdsEnd_get_chain_hash(uint64_t this_ptr) {
41973         LDKReplyShortChannelIdsEnd this_ptr_conv;
41974         this_ptr_conv.inner = untag_ptr(this_ptr);
41975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41977         this_ptr_conv.is_owned = false;
41978         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
41979         memcpy(ret_arr->elems, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv), 32);
41980         return ret_arr;
41981 }
41982
41983 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_chain_hash"))) TS_ReplyShortChannelIdsEnd_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
41984         LDKReplyShortChannelIdsEnd this_ptr_conv;
41985         this_ptr_conv.inner = untag_ptr(this_ptr);
41986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41988         this_ptr_conv.is_owned = false;
41989         LDKThirtyTwoBytes val_ref;
41990         CHECK(val->arr_len == 32);
41991         memcpy(val_ref.data, val->elems, 32); FREE(val);
41992         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
41993 }
41994
41995 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_get_full_information"))) TS_ReplyShortChannelIdsEnd_get_full_information(uint64_t this_ptr) {
41996         LDKReplyShortChannelIdsEnd this_ptr_conv;
41997         this_ptr_conv.inner = untag_ptr(this_ptr);
41998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42000         this_ptr_conv.is_owned = false;
42001         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
42002         return ret_conv;
42003 }
42004
42005 void  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_set_full_information"))) TS_ReplyShortChannelIdsEnd_set_full_information(uint64_t this_ptr, jboolean val) {
42006         LDKReplyShortChannelIdsEnd this_ptr_conv;
42007         this_ptr_conv.inner = untag_ptr(this_ptr);
42008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42010         this_ptr_conv.is_owned = false;
42011         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
42012 }
42013
42014 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_new"))) TS_ReplyShortChannelIdsEnd_new(int8_tArray chain_hash_arg, jboolean full_information_arg) {
42015         LDKThirtyTwoBytes chain_hash_arg_ref;
42016         CHECK(chain_hash_arg->arr_len == 32);
42017         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42018         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
42019         uint64_t ret_ref = 0;
42020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42022         return ret_ref;
42023 }
42024
42025 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
42026         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
42027         uint64_t ret_ref = 0;
42028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42030         return ret_ref;
42031 }
42032 int64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone_ptr"))) TS_ReplyShortChannelIdsEnd_clone_ptr(uint64_t arg) {
42033         LDKReplyShortChannelIdsEnd arg_conv;
42034         arg_conv.inner = untag_ptr(arg);
42035         arg_conv.is_owned = ptr_is_owned(arg);
42036         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42037         arg_conv.is_owned = false;
42038         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
42039         return ret_conv;
42040 }
42041
42042 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_clone"))) TS_ReplyShortChannelIdsEnd_clone(uint64_t orig) {
42043         LDKReplyShortChannelIdsEnd orig_conv;
42044         orig_conv.inner = untag_ptr(orig);
42045         orig_conv.is_owned = ptr_is_owned(orig);
42046         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42047         orig_conv.is_owned = false;
42048         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
42049         uint64_t ret_ref = 0;
42050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42052         return ret_ref;
42053 }
42054
42055 jboolean  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_eq"))) TS_ReplyShortChannelIdsEnd_eq(uint64_t a, uint64_t b) {
42056         LDKReplyShortChannelIdsEnd a_conv;
42057         a_conv.inner = untag_ptr(a);
42058         a_conv.is_owned = ptr_is_owned(a);
42059         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42060         a_conv.is_owned = false;
42061         LDKReplyShortChannelIdsEnd b_conv;
42062         b_conv.inner = untag_ptr(b);
42063         b_conv.is_owned = ptr_is_owned(b);
42064         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42065         b_conv.is_owned = false;
42066         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
42067         return ret_conv;
42068 }
42069
42070 void  __attribute__((export_name("TS_GossipTimestampFilter_free"))) TS_GossipTimestampFilter_free(uint64_t this_obj) {
42071         LDKGossipTimestampFilter this_obj_conv;
42072         this_obj_conv.inner = untag_ptr(this_obj);
42073         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42075         GossipTimestampFilter_free(this_obj_conv);
42076 }
42077
42078 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_get_chain_hash"))) TS_GossipTimestampFilter_get_chain_hash(uint64_t this_ptr) {
42079         LDKGossipTimestampFilter this_ptr_conv;
42080         this_ptr_conv.inner = untag_ptr(this_ptr);
42081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42083         this_ptr_conv.is_owned = false;
42084         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
42085         memcpy(ret_arr->elems, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv), 32);
42086         return ret_arr;
42087 }
42088
42089 void  __attribute__((export_name("TS_GossipTimestampFilter_set_chain_hash"))) TS_GossipTimestampFilter_set_chain_hash(uint64_t this_ptr, int8_tArray val) {
42090         LDKGossipTimestampFilter this_ptr_conv;
42091         this_ptr_conv.inner = untag_ptr(this_ptr);
42092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42094         this_ptr_conv.is_owned = false;
42095         LDKThirtyTwoBytes val_ref;
42096         CHECK(val->arr_len == 32);
42097         memcpy(val_ref.data, val->elems, 32); FREE(val);
42098         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
42099 }
42100
42101 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_first_timestamp"))) TS_GossipTimestampFilter_get_first_timestamp(uint64_t this_ptr) {
42102         LDKGossipTimestampFilter this_ptr_conv;
42103         this_ptr_conv.inner = untag_ptr(this_ptr);
42104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42106         this_ptr_conv.is_owned = false;
42107         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
42108         return ret_conv;
42109 }
42110
42111 void  __attribute__((export_name("TS_GossipTimestampFilter_set_first_timestamp"))) TS_GossipTimestampFilter_set_first_timestamp(uint64_t this_ptr, int32_t val) {
42112         LDKGossipTimestampFilter this_ptr_conv;
42113         this_ptr_conv.inner = untag_ptr(this_ptr);
42114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42116         this_ptr_conv.is_owned = false;
42117         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
42118 }
42119
42120 int32_t  __attribute__((export_name("TS_GossipTimestampFilter_get_timestamp_range"))) TS_GossipTimestampFilter_get_timestamp_range(uint64_t this_ptr) {
42121         LDKGossipTimestampFilter 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         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
42127         return ret_conv;
42128 }
42129
42130 void  __attribute__((export_name("TS_GossipTimestampFilter_set_timestamp_range"))) TS_GossipTimestampFilter_set_timestamp_range(uint64_t this_ptr, int32_t val) {
42131         LDKGossipTimestampFilter this_ptr_conv;
42132         this_ptr_conv.inner = untag_ptr(this_ptr);
42133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42135         this_ptr_conv.is_owned = false;
42136         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
42137 }
42138
42139 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) {
42140         LDKThirtyTwoBytes chain_hash_arg_ref;
42141         CHECK(chain_hash_arg->arr_len == 32);
42142         memcpy(chain_hash_arg_ref.data, chain_hash_arg->elems, 32); FREE(chain_hash_arg);
42143         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
42144         uint64_t ret_ref = 0;
42145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42147         return ret_ref;
42148 }
42149
42150 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
42151         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
42152         uint64_t ret_ref = 0;
42153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42155         return ret_ref;
42156 }
42157 int64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone_ptr"))) TS_GossipTimestampFilter_clone_ptr(uint64_t arg) {
42158         LDKGossipTimestampFilter arg_conv;
42159         arg_conv.inner = untag_ptr(arg);
42160         arg_conv.is_owned = ptr_is_owned(arg);
42161         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42162         arg_conv.is_owned = false;
42163         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
42164         return ret_conv;
42165 }
42166
42167 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_clone"))) TS_GossipTimestampFilter_clone(uint64_t orig) {
42168         LDKGossipTimestampFilter orig_conv;
42169         orig_conv.inner = untag_ptr(orig);
42170         orig_conv.is_owned = ptr_is_owned(orig);
42171         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42172         orig_conv.is_owned = false;
42173         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
42174         uint64_t ret_ref = 0;
42175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42177         return ret_ref;
42178 }
42179
42180 jboolean  __attribute__((export_name("TS_GossipTimestampFilter_eq"))) TS_GossipTimestampFilter_eq(uint64_t a, uint64_t b) {
42181         LDKGossipTimestampFilter a_conv;
42182         a_conv.inner = untag_ptr(a);
42183         a_conv.is_owned = ptr_is_owned(a);
42184         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42185         a_conv.is_owned = false;
42186         LDKGossipTimestampFilter b_conv;
42187         b_conv.inner = untag_ptr(b);
42188         b_conv.is_owned = ptr_is_owned(b);
42189         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42190         b_conv.is_owned = false;
42191         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
42192         return ret_conv;
42193 }
42194
42195 void  __attribute__((export_name("TS_ErrorAction_free"))) TS_ErrorAction_free(uint64_t this_ptr) {
42196         if (!ptr_is_owned(this_ptr)) return;
42197         void* this_ptr_ptr = untag_ptr(this_ptr);
42198         CHECK_ACCESS(this_ptr_ptr);
42199         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
42200         FREE(untag_ptr(this_ptr));
42201         ErrorAction_free(this_ptr_conv);
42202 }
42203
42204 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
42205         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42206         *ret_copy = ErrorAction_clone(arg);
42207         uint64_t ret_ref = tag_ptr(ret_copy, true);
42208         return ret_ref;
42209 }
42210 int64_t  __attribute__((export_name("TS_ErrorAction_clone_ptr"))) TS_ErrorAction_clone_ptr(uint64_t arg) {
42211         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
42212         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
42213         return ret_conv;
42214 }
42215
42216 uint64_t  __attribute__((export_name("TS_ErrorAction_clone"))) TS_ErrorAction_clone(uint64_t orig) {
42217         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
42218         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42219         *ret_copy = ErrorAction_clone(orig_conv);
42220         uint64_t ret_ref = tag_ptr(ret_copy, true);
42221         return ret_ref;
42222 }
42223
42224 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer"))) TS_ErrorAction_disconnect_peer(uint64_t msg) {
42225         LDKErrorMessage msg_conv;
42226         msg_conv.inner = untag_ptr(msg);
42227         msg_conv.is_owned = ptr_is_owned(msg);
42228         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42229         msg_conv = ErrorMessage_clone(&msg_conv);
42230         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42231         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
42232         uint64_t ret_ref = tag_ptr(ret_copy, true);
42233         return ret_ref;
42234 }
42235
42236 uint64_t  __attribute__((export_name("TS_ErrorAction_disconnect_peer_with_warning"))) TS_ErrorAction_disconnect_peer_with_warning(uint64_t msg) {
42237         LDKWarningMessage msg_conv;
42238         msg_conv.inner = untag_ptr(msg);
42239         msg_conv.is_owned = ptr_is_owned(msg);
42240         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42241         msg_conv = WarningMessage_clone(&msg_conv);
42242         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42243         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
42244         uint64_t ret_ref = tag_ptr(ret_copy, true);
42245         return ret_ref;
42246 }
42247
42248 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_error"))) TS_ErrorAction_ignore_error() {
42249         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42250         *ret_copy = ErrorAction_ignore_error();
42251         uint64_t ret_ref = tag_ptr(ret_copy, true);
42252         return ret_ref;
42253 }
42254
42255 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_and_log"))) TS_ErrorAction_ignore_and_log(uint32_t a) {
42256         LDKLevel a_conv = LDKLevel_from_js(a);
42257         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42258         *ret_copy = ErrorAction_ignore_and_log(a_conv);
42259         uint64_t ret_ref = tag_ptr(ret_copy, true);
42260         return ret_ref;
42261 }
42262
42263 uint64_t  __attribute__((export_name("TS_ErrorAction_ignore_duplicate_gossip"))) TS_ErrorAction_ignore_duplicate_gossip() {
42264         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42265         *ret_copy = ErrorAction_ignore_duplicate_gossip();
42266         uint64_t ret_ref = tag_ptr(ret_copy, true);
42267         return ret_ref;
42268 }
42269
42270 uint64_t  __attribute__((export_name("TS_ErrorAction_send_error_message"))) TS_ErrorAction_send_error_message(uint64_t msg) {
42271         LDKErrorMessage msg_conv;
42272         msg_conv.inner = untag_ptr(msg);
42273         msg_conv.is_owned = ptr_is_owned(msg);
42274         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42275         msg_conv = ErrorMessage_clone(&msg_conv);
42276         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42277         *ret_copy = ErrorAction_send_error_message(msg_conv);
42278         uint64_t ret_ref = tag_ptr(ret_copy, true);
42279         return ret_ref;
42280 }
42281
42282 uint64_t  __attribute__((export_name("TS_ErrorAction_send_warning_message"))) TS_ErrorAction_send_warning_message(uint64_t msg, uint32_t log_level) {
42283         LDKWarningMessage msg_conv;
42284         msg_conv.inner = untag_ptr(msg);
42285         msg_conv.is_owned = ptr_is_owned(msg);
42286         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
42287         msg_conv = WarningMessage_clone(&msg_conv);
42288         LDKLevel log_level_conv = LDKLevel_from_js(log_level);
42289         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42290         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
42291         uint64_t ret_ref = tag_ptr(ret_copy, true);
42292         return ret_ref;
42293 }
42294
42295 void  __attribute__((export_name("TS_LightningError_free"))) TS_LightningError_free(uint64_t this_obj) {
42296         LDKLightningError this_obj_conv;
42297         this_obj_conv.inner = untag_ptr(this_obj);
42298         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42300         LightningError_free(this_obj_conv);
42301 }
42302
42303 jstring  __attribute__((export_name("TS_LightningError_get_err"))) TS_LightningError_get_err(uint64_t this_ptr) {
42304         LDKLightningError this_ptr_conv;
42305         this_ptr_conv.inner = untag_ptr(this_ptr);
42306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42308         this_ptr_conv.is_owned = false;
42309         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
42310         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
42311         Str_free(ret_str);
42312         return ret_conv;
42313 }
42314
42315 void  __attribute__((export_name("TS_LightningError_set_err"))) TS_LightningError_set_err(uint64_t this_ptr, jstring val) {
42316         LDKLightningError this_ptr_conv;
42317         this_ptr_conv.inner = untag_ptr(this_ptr);
42318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42320         this_ptr_conv.is_owned = false;
42321         LDKStr val_conv = str_ref_to_owned_c(val);
42322         LightningError_set_err(&this_ptr_conv, val_conv);
42323 }
42324
42325 uint64_t  __attribute__((export_name("TS_LightningError_get_action"))) TS_LightningError_get_action(uint64_t this_ptr) {
42326         LDKLightningError this_ptr_conv;
42327         this_ptr_conv.inner = untag_ptr(this_ptr);
42328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42330         this_ptr_conv.is_owned = false;
42331         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
42332         *ret_copy = LightningError_get_action(&this_ptr_conv);
42333         uint64_t ret_ref = tag_ptr(ret_copy, true);
42334         return ret_ref;
42335 }
42336
42337 void  __attribute__((export_name("TS_LightningError_set_action"))) TS_LightningError_set_action(uint64_t this_ptr, uint64_t val) {
42338         LDKLightningError this_ptr_conv;
42339         this_ptr_conv.inner = untag_ptr(this_ptr);
42340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42342         this_ptr_conv.is_owned = false;
42343         void* val_ptr = untag_ptr(val);
42344         CHECK_ACCESS(val_ptr);
42345         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
42346         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
42347         LightningError_set_action(&this_ptr_conv, val_conv);
42348 }
42349
42350 uint64_t  __attribute__((export_name("TS_LightningError_new"))) TS_LightningError_new(jstring err_arg, uint64_t action_arg) {
42351         LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
42352         void* action_arg_ptr = untag_ptr(action_arg);
42353         CHECK_ACCESS(action_arg_ptr);
42354         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
42355         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
42356         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
42357         uint64_t ret_ref = 0;
42358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42360         return ret_ref;
42361 }
42362
42363 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
42364         LDKLightningError ret_var = LightningError_clone(arg);
42365         uint64_t ret_ref = 0;
42366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42368         return ret_ref;
42369 }
42370 int64_t  __attribute__((export_name("TS_LightningError_clone_ptr"))) TS_LightningError_clone_ptr(uint64_t arg) {
42371         LDKLightningError arg_conv;
42372         arg_conv.inner = untag_ptr(arg);
42373         arg_conv.is_owned = ptr_is_owned(arg);
42374         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42375         arg_conv.is_owned = false;
42376         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
42377         return ret_conv;
42378 }
42379
42380 uint64_t  __attribute__((export_name("TS_LightningError_clone"))) TS_LightningError_clone(uint64_t orig) {
42381         LDKLightningError orig_conv;
42382         orig_conv.inner = untag_ptr(orig);
42383         orig_conv.is_owned = ptr_is_owned(orig);
42384         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42385         orig_conv.is_owned = false;
42386         LDKLightningError ret_var = LightningError_clone(&orig_conv);
42387         uint64_t ret_ref = 0;
42388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42390         return ret_ref;
42391 }
42392
42393 void  __attribute__((export_name("TS_CommitmentUpdate_free"))) TS_CommitmentUpdate_free(uint64_t this_obj) {
42394         LDKCommitmentUpdate this_obj_conv;
42395         this_obj_conv.inner = untag_ptr(this_obj);
42396         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42398         CommitmentUpdate_free(this_obj_conv);
42399 }
42400
42401 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_add_htlcs"))) TS_CommitmentUpdate_get_update_add_htlcs(uint64_t this_ptr) {
42402         LDKCommitmentUpdate this_ptr_conv;
42403         this_ptr_conv.inner = untag_ptr(this_ptr);
42404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42406         this_ptr_conv.is_owned = false;
42407         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
42408         uint64_tArray ret_arr = NULL;
42409         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42410         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42411         for (size_t p = 0; p < ret_var.datalen; p++) {
42412                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
42413                 uint64_t ret_conv_15_ref = 0;
42414                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
42415                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
42416                 ret_arr_ptr[p] = ret_conv_15_ref;
42417         }
42418         
42419         FREE(ret_var.data);
42420         return ret_arr;
42421 }
42422
42423 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_add_htlcs"))) TS_CommitmentUpdate_set_update_add_htlcs(uint64_t this_ptr, uint64_tArray val) {
42424         LDKCommitmentUpdate this_ptr_conv;
42425         this_ptr_conv.inner = untag_ptr(this_ptr);
42426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42428         this_ptr_conv.is_owned = false;
42429         LDKCVec_UpdateAddHTLCZ val_constr;
42430         val_constr.datalen = val->arr_len;
42431         if (val_constr.datalen > 0)
42432                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
42433         else
42434                 val_constr.data = NULL;
42435         uint64_t* val_vals = val->elems;
42436         for (size_t p = 0; p < val_constr.datalen; p++) {
42437                 uint64_t val_conv_15 = val_vals[p];
42438                 LDKUpdateAddHTLC val_conv_15_conv;
42439                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
42440                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
42441                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
42442                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
42443                 val_constr.data[p] = val_conv_15_conv;
42444         }
42445         FREE(val);
42446         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
42447 }
42448
42449 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fulfill_htlcs"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint64_t this_ptr) {
42450         LDKCommitmentUpdate this_ptr_conv;
42451         this_ptr_conv.inner = untag_ptr(this_ptr);
42452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42454         this_ptr_conv.is_owned = false;
42455         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
42456         uint64_tArray ret_arr = NULL;
42457         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42458         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42459         for (size_t t = 0; t < ret_var.datalen; t++) {
42460                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
42461                 uint64_t ret_conv_19_ref = 0;
42462                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
42463                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
42464                 ret_arr_ptr[t] = ret_conv_19_ref;
42465         }
42466         
42467         FREE(ret_var.data);
42468         return ret_arr;
42469 }
42470
42471 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fulfill_htlcs"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint64_t this_ptr, uint64_tArray val) {
42472         LDKCommitmentUpdate this_ptr_conv;
42473         this_ptr_conv.inner = untag_ptr(this_ptr);
42474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42476         this_ptr_conv.is_owned = false;
42477         LDKCVec_UpdateFulfillHTLCZ val_constr;
42478         val_constr.datalen = val->arr_len;
42479         if (val_constr.datalen > 0)
42480                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
42481         else
42482                 val_constr.data = NULL;
42483         uint64_t* val_vals = val->elems;
42484         for (size_t t = 0; t < val_constr.datalen; t++) {
42485                 uint64_t val_conv_19 = val_vals[t];
42486                 LDKUpdateFulfillHTLC val_conv_19_conv;
42487                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
42488                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
42489                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
42490                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
42491                 val_constr.data[t] = val_conv_19_conv;
42492         }
42493         FREE(val);
42494         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
42495 }
42496
42497 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_htlcs"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint64_t this_ptr) {
42498         LDKCommitmentUpdate this_ptr_conv;
42499         this_ptr_conv.inner = untag_ptr(this_ptr);
42500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42502         this_ptr_conv.is_owned = false;
42503         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
42504         uint64_tArray ret_arr = NULL;
42505         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42506         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42507         for (size_t q = 0; q < ret_var.datalen; q++) {
42508                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
42509                 uint64_t ret_conv_16_ref = 0;
42510                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
42511                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
42512                 ret_arr_ptr[q] = ret_conv_16_ref;
42513         }
42514         
42515         FREE(ret_var.data);
42516         return ret_arr;
42517 }
42518
42519 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fail_htlcs"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint64_t this_ptr, uint64_tArray val) {
42520         LDKCommitmentUpdate this_ptr_conv;
42521         this_ptr_conv.inner = untag_ptr(this_ptr);
42522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42524         this_ptr_conv.is_owned = false;
42525         LDKCVec_UpdateFailHTLCZ val_constr;
42526         val_constr.datalen = val->arr_len;
42527         if (val_constr.datalen > 0)
42528                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
42529         else
42530                 val_constr.data = NULL;
42531         uint64_t* val_vals = val->elems;
42532         for (size_t q = 0; q < val_constr.datalen; q++) {
42533                 uint64_t val_conv_16 = val_vals[q];
42534                 LDKUpdateFailHTLC val_conv_16_conv;
42535                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
42536                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
42537                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
42538                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
42539                 val_constr.data[q] = val_conv_16_conv;
42540         }
42541         FREE(val);
42542         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
42543 }
42544
42545 uint64_tArray  __attribute__((export_name("TS_CommitmentUpdate_get_update_fail_malformed_htlcs"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint64_t this_ptr) {
42546         LDKCommitmentUpdate this_ptr_conv;
42547         this_ptr_conv.inner = untag_ptr(this_ptr);
42548         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42550         this_ptr_conv.is_owned = false;
42551         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
42552         uint64_tArray ret_arr = NULL;
42553         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
42554         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
42555         for (size_t z = 0; z < ret_var.datalen; z++) {
42556                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
42557                 uint64_t ret_conv_25_ref = 0;
42558                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
42559                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
42560                 ret_arr_ptr[z] = ret_conv_25_ref;
42561         }
42562         
42563         FREE(ret_var.data);
42564         return ret_arr;
42565 }
42566
42567 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) {
42568         LDKCommitmentUpdate this_ptr_conv;
42569         this_ptr_conv.inner = untag_ptr(this_ptr);
42570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42572         this_ptr_conv.is_owned = false;
42573         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
42574         val_constr.datalen = val->arr_len;
42575         if (val_constr.datalen > 0)
42576                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
42577         else
42578                 val_constr.data = NULL;
42579         uint64_t* val_vals = val->elems;
42580         for (size_t z = 0; z < val_constr.datalen; z++) {
42581                 uint64_t val_conv_25 = val_vals[z];
42582                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
42583                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
42584                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
42585                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
42586                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
42587                 val_constr.data[z] = val_conv_25_conv;
42588         }
42589         FREE(val);
42590         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
42591 }
42592
42593 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_update_fee"))) TS_CommitmentUpdate_get_update_fee(uint64_t this_ptr) {
42594         LDKCommitmentUpdate this_ptr_conv;
42595         this_ptr_conv.inner = untag_ptr(this_ptr);
42596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42598         this_ptr_conv.is_owned = false;
42599         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
42600         uint64_t ret_ref = 0;
42601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42603         return ret_ref;
42604 }
42605
42606 void  __attribute__((export_name("TS_CommitmentUpdate_set_update_fee"))) TS_CommitmentUpdate_set_update_fee(uint64_t this_ptr, uint64_t val) {
42607         LDKCommitmentUpdate this_ptr_conv;
42608         this_ptr_conv.inner = untag_ptr(this_ptr);
42609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42611         this_ptr_conv.is_owned = false;
42612         LDKUpdateFee val_conv;
42613         val_conv.inner = untag_ptr(val);
42614         val_conv.is_owned = ptr_is_owned(val);
42615         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42616         val_conv = UpdateFee_clone(&val_conv);
42617         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
42618 }
42619
42620 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_get_commitment_signed"))) TS_CommitmentUpdate_get_commitment_signed(uint64_t this_ptr) {
42621         LDKCommitmentUpdate this_ptr_conv;
42622         this_ptr_conv.inner = untag_ptr(this_ptr);
42623         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42625         this_ptr_conv.is_owned = false;
42626         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
42627         uint64_t ret_ref = 0;
42628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42630         return ret_ref;
42631 }
42632
42633 void  __attribute__((export_name("TS_CommitmentUpdate_set_commitment_signed"))) TS_CommitmentUpdate_set_commitment_signed(uint64_t this_ptr, uint64_t val) {
42634         LDKCommitmentUpdate this_ptr_conv;
42635         this_ptr_conv.inner = untag_ptr(this_ptr);
42636         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42638         this_ptr_conv.is_owned = false;
42639         LDKCommitmentSigned val_conv;
42640         val_conv.inner = untag_ptr(val);
42641         val_conv.is_owned = ptr_is_owned(val);
42642         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42643         val_conv = CommitmentSigned_clone(&val_conv);
42644         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
42645 }
42646
42647 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) {
42648         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
42649         update_add_htlcs_arg_constr.datalen = update_add_htlcs_arg->arr_len;
42650         if (update_add_htlcs_arg_constr.datalen > 0)
42651                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
42652         else
42653                 update_add_htlcs_arg_constr.data = NULL;
42654         uint64_t* update_add_htlcs_arg_vals = update_add_htlcs_arg->elems;
42655         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
42656                 uint64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
42657                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
42658                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
42659                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
42660                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
42661                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
42662                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
42663         }
42664         FREE(update_add_htlcs_arg);
42665         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
42666         update_fulfill_htlcs_arg_constr.datalen = update_fulfill_htlcs_arg->arr_len;
42667         if (update_fulfill_htlcs_arg_constr.datalen > 0)
42668                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
42669         else
42670                 update_fulfill_htlcs_arg_constr.data = NULL;
42671         uint64_t* update_fulfill_htlcs_arg_vals = update_fulfill_htlcs_arg->elems;
42672         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
42673                 uint64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
42674                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
42675                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
42676                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
42677                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
42678                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
42679                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
42680         }
42681         FREE(update_fulfill_htlcs_arg);
42682         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
42683         update_fail_htlcs_arg_constr.datalen = update_fail_htlcs_arg->arr_len;
42684         if (update_fail_htlcs_arg_constr.datalen > 0)
42685                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
42686         else
42687                 update_fail_htlcs_arg_constr.data = NULL;
42688         uint64_t* update_fail_htlcs_arg_vals = update_fail_htlcs_arg->elems;
42689         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
42690                 uint64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
42691                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
42692                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
42693                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
42694                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
42695                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
42696                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
42697         }
42698         FREE(update_fail_htlcs_arg);
42699         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
42700         update_fail_malformed_htlcs_arg_constr.datalen = update_fail_malformed_htlcs_arg->arr_len;
42701         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
42702                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
42703         else
42704                 update_fail_malformed_htlcs_arg_constr.data = NULL;
42705         uint64_t* update_fail_malformed_htlcs_arg_vals = update_fail_malformed_htlcs_arg->elems;
42706         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
42707                 uint64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
42708                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
42709                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
42710                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
42711                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
42712                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
42713                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
42714         }
42715         FREE(update_fail_malformed_htlcs_arg);
42716         LDKUpdateFee update_fee_arg_conv;
42717         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
42718         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
42719         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
42720         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
42721         LDKCommitmentSigned commitment_signed_arg_conv;
42722         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
42723         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
42724         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
42725         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
42726         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);
42727         uint64_t ret_ref = 0;
42728         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42729         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42730         return ret_ref;
42731 }
42732
42733 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
42734         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
42735         uint64_t ret_ref = 0;
42736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42738         return ret_ref;
42739 }
42740 int64_t  __attribute__((export_name("TS_CommitmentUpdate_clone_ptr"))) TS_CommitmentUpdate_clone_ptr(uint64_t arg) {
42741         LDKCommitmentUpdate arg_conv;
42742         arg_conv.inner = untag_ptr(arg);
42743         arg_conv.is_owned = ptr_is_owned(arg);
42744         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42745         arg_conv.is_owned = false;
42746         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
42747         return ret_conv;
42748 }
42749
42750 uint64_t  __attribute__((export_name("TS_CommitmentUpdate_clone"))) TS_CommitmentUpdate_clone(uint64_t orig) {
42751         LDKCommitmentUpdate orig_conv;
42752         orig_conv.inner = untag_ptr(orig);
42753         orig_conv.is_owned = ptr_is_owned(orig);
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42755         orig_conv.is_owned = false;
42756         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
42757         uint64_t ret_ref = 0;
42758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42760         return ret_ref;
42761 }
42762
42763 jboolean  __attribute__((export_name("TS_CommitmentUpdate_eq"))) TS_CommitmentUpdate_eq(uint64_t a, uint64_t b) {
42764         LDKCommitmentUpdate a_conv;
42765         a_conv.inner = untag_ptr(a);
42766         a_conv.is_owned = ptr_is_owned(a);
42767         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
42768         a_conv.is_owned = false;
42769         LDKCommitmentUpdate b_conv;
42770         b_conv.inner = untag_ptr(b);
42771         b_conv.is_owned = ptr_is_owned(b);
42772         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
42773         b_conv.is_owned = false;
42774         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
42775         return ret_conv;
42776 }
42777
42778 void  __attribute__((export_name("TS_ChannelMessageHandler_free"))) TS_ChannelMessageHandler_free(uint64_t this_ptr) {
42779         if (!ptr_is_owned(this_ptr)) return;
42780         void* this_ptr_ptr = untag_ptr(this_ptr);
42781         CHECK_ACCESS(this_ptr_ptr);
42782         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
42783         FREE(untag_ptr(this_ptr));
42784         ChannelMessageHandler_free(this_ptr_conv);
42785 }
42786
42787 void  __attribute__((export_name("TS_RoutingMessageHandler_free"))) TS_RoutingMessageHandler_free(uint64_t this_ptr) {
42788         if (!ptr_is_owned(this_ptr)) return;
42789         void* this_ptr_ptr = untag_ptr(this_ptr);
42790         CHECK_ACCESS(this_ptr_ptr);
42791         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
42792         FREE(untag_ptr(this_ptr));
42793         RoutingMessageHandler_free(this_ptr_conv);
42794 }
42795
42796 void  __attribute__((export_name("TS_OnionMessageHandler_free"))) TS_OnionMessageHandler_free(uint64_t this_ptr) {
42797         if (!ptr_is_owned(this_ptr)) return;
42798         void* this_ptr_ptr = untag_ptr(this_ptr);
42799         CHECK_ACCESS(this_ptr_ptr);
42800         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
42801         FREE(untag_ptr(this_ptr));
42802         OnionMessageHandler_free(this_ptr_conv);
42803 }
42804
42805 int8_tArray  __attribute__((export_name("TS_AcceptChannel_write"))) TS_AcceptChannel_write(uint64_t obj) {
42806         LDKAcceptChannel obj_conv;
42807         obj_conv.inner = untag_ptr(obj);
42808         obj_conv.is_owned = ptr_is_owned(obj);
42809         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42810         obj_conv.is_owned = false;
42811         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
42812         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42813         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42814         CVec_u8Z_free(ret_var);
42815         return ret_arr;
42816 }
42817
42818 uint64_t  __attribute__((export_name("TS_AcceptChannel_read"))) TS_AcceptChannel_read(int8_tArray ser) {
42819         LDKu8slice ser_ref;
42820         ser_ref.datalen = ser->arr_len;
42821         ser_ref.data = ser->elems;
42822         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
42823         *ret_conv = AcceptChannel_read(ser_ref);
42824         FREE(ser);
42825         return tag_ptr(ret_conv, true);
42826 }
42827
42828 int8_tArray  __attribute__((export_name("TS_AcceptChannelV2_write"))) TS_AcceptChannelV2_write(uint64_t obj) {
42829         LDKAcceptChannelV2 obj_conv;
42830         obj_conv.inner = untag_ptr(obj);
42831         obj_conv.is_owned = ptr_is_owned(obj);
42832         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42833         obj_conv.is_owned = false;
42834         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
42835         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42836         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42837         CVec_u8Z_free(ret_var);
42838         return ret_arr;
42839 }
42840
42841 uint64_t  __attribute__((export_name("TS_AcceptChannelV2_read"))) TS_AcceptChannelV2_read(int8_tArray ser) {
42842         LDKu8slice ser_ref;
42843         ser_ref.datalen = ser->arr_len;
42844         ser_ref.data = ser->elems;
42845         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
42846         *ret_conv = AcceptChannelV2_read(ser_ref);
42847         FREE(ser);
42848         return tag_ptr(ret_conv, true);
42849 }
42850
42851 int8_tArray  __attribute__((export_name("TS_TxAddInput_write"))) TS_TxAddInput_write(uint64_t obj) {
42852         LDKTxAddInput obj_conv;
42853         obj_conv.inner = untag_ptr(obj);
42854         obj_conv.is_owned = ptr_is_owned(obj);
42855         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42856         obj_conv.is_owned = false;
42857         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
42858         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42859         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42860         CVec_u8Z_free(ret_var);
42861         return ret_arr;
42862 }
42863
42864 uint64_t  __attribute__((export_name("TS_TxAddInput_read"))) TS_TxAddInput_read(int8_tArray ser) {
42865         LDKu8slice ser_ref;
42866         ser_ref.datalen = ser->arr_len;
42867         ser_ref.data = ser->elems;
42868         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
42869         *ret_conv = TxAddInput_read(ser_ref);
42870         FREE(ser);
42871         return tag_ptr(ret_conv, true);
42872 }
42873
42874 int8_tArray  __attribute__((export_name("TS_TxAddOutput_write"))) TS_TxAddOutput_write(uint64_t obj) {
42875         LDKTxAddOutput obj_conv;
42876         obj_conv.inner = untag_ptr(obj);
42877         obj_conv.is_owned = ptr_is_owned(obj);
42878         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42879         obj_conv.is_owned = false;
42880         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
42881         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42882         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42883         CVec_u8Z_free(ret_var);
42884         return ret_arr;
42885 }
42886
42887 uint64_t  __attribute__((export_name("TS_TxAddOutput_read"))) TS_TxAddOutput_read(int8_tArray ser) {
42888         LDKu8slice ser_ref;
42889         ser_ref.datalen = ser->arr_len;
42890         ser_ref.data = ser->elems;
42891         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
42892         *ret_conv = TxAddOutput_read(ser_ref);
42893         FREE(ser);
42894         return tag_ptr(ret_conv, true);
42895 }
42896
42897 int8_tArray  __attribute__((export_name("TS_TxRemoveInput_write"))) TS_TxRemoveInput_write(uint64_t obj) {
42898         LDKTxRemoveInput obj_conv;
42899         obj_conv.inner = untag_ptr(obj);
42900         obj_conv.is_owned = ptr_is_owned(obj);
42901         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42902         obj_conv.is_owned = false;
42903         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
42904         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42905         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42906         CVec_u8Z_free(ret_var);
42907         return ret_arr;
42908 }
42909
42910 uint64_t  __attribute__((export_name("TS_TxRemoveInput_read"))) TS_TxRemoveInput_read(int8_tArray ser) {
42911         LDKu8slice ser_ref;
42912         ser_ref.datalen = ser->arr_len;
42913         ser_ref.data = ser->elems;
42914         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
42915         *ret_conv = TxRemoveInput_read(ser_ref);
42916         FREE(ser);
42917         return tag_ptr(ret_conv, true);
42918 }
42919
42920 int8_tArray  __attribute__((export_name("TS_TxRemoveOutput_write"))) TS_TxRemoveOutput_write(uint64_t obj) {
42921         LDKTxRemoveOutput obj_conv;
42922         obj_conv.inner = untag_ptr(obj);
42923         obj_conv.is_owned = ptr_is_owned(obj);
42924         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42925         obj_conv.is_owned = false;
42926         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
42927         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42928         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42929         CVec_u8Z_free(ret_var);
42930         return ret_arr;
42931 }
42932
42933 uint64_t  __attribute__((export_name("TS_TxRemoveOutput_read"))) TS_TxRemoveOutput_read(int8_tArray ser) {
42934         LDKu8slice ser_ref;
42935         ser_ref.datalen = ser->arr_len;
42936         ser_ref.data = ser->elems;
42937         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
42938         *ret_conv = TxRemoveOutput_read(ser_ref);
42939         FREE(ser);
42940         return tag_ptr(ret_conv, true);
42941 }
42942
42943 int8_tArray  __attribute__((export_name("TS_TxComplete_write"))) TS_TxComplete_write(uint64_t obj) {
42944         LDKTxComplete obj_conv;
42945         obj_conv.inner = untag_ptr(obj);
42946         obj_conv.is_owned = ptr_is_owned(obj);
42947         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42948         obj_conv.is_owned = false;
42949         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
42950         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42951         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42952         CVec_u8Z_free(ret_var);
42953         return ret_arr;
42954 }
42955
42956 uint64_t  __attribute__((export_name("TS_TxComplete_read"))) TS_TxComplete_read(int8_tArray ser) {
42957         LDKu8slice ser_ref;
42958         ser_ref.datalen = ser->arr_len;
42959         ser_ref.data = ser->elems;
42960         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
42961         *ret_conv = TxComplete_read(ser_ref);
42962         FREE(ser);
42963         return tag_ptr(ret_conv, true);
42964 }
42965
42966 int8_tArray  __attribute__((export_name("TS_TxSignatures_write"))) TS_TxSignatures_write(uint64_t obj) {
42967         LDKTxSignatures obj_conv;
42968         obj_conv.inner = untag_ptr(obj);
42969         obj_conv.is_owned = ptr_is_owned(obj);
42970         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42971         obj_conv.is_owned = false;
42972         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
42973         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42974         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42975         CVec_u8Z_free(ret_var);
42976         return ret_arr;
42977 }
42978
42979 uint64_t  __attribute__((export_name("TS_TxSignatures_read"))) TS_TxSignatures_read(int8_tArray ser) {
42980         LDKu8slice ser_ref;
42981         ser_ref.datalen = ser->arr_len;
42982         ser_ref.data = ser->elems;
42983         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
42984         *ret_conv = TxSignatures_read(ser_ref);
42985         FREE(ser);
42986         return tag_ptr(ret_conv, true);
42987 }
42988
42989 int8_tArray  __attribute__((export_name("TS_TxInitRbf_write"))) TS_TxInitRbf_write(uint64_t obj) {
42990         LDKTxInitRbf obj_conv;
42991         obj_conv.inner = untag_ptr(obj);
42992         obj_conv.is_owned = ptr_is_owned(obj);
42993         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
42994         obj_conv.is_owned = false;
42995         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
42996         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
42997         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
42998         CVec_u8Z_free(ret_var);
42999         return ret_arr;
43000 }
43001
43002 uint64_t  __attribute__((export_name("TS_TxInitRbf_read"))) TS_TxInitRbf_read(int8_tArray ser) {
43003         LDKu8slice ser_ref;
43004         ser_ref.datalen = ser->arr_len;
43005         ser_ref.data = ser->elems;
43006         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
43007         *ret_conv = TxInitRbf_read(ser_ref);
43008         FREE(ser);
43009         return tag_ptr(ret_conv, true);
43010 }
43011
43012 int8_tArray  __attribute__((export_name("TS_TxAckRbf_write"))) TS_TxAckRbf_write(uint64_t obj) {
43013         LDKTxAckRbf obj_conv;
43014         obj_conv.inner = untag_ptr(obj);
43015         obj_conv.is_owned = ptr_is_owned(obj);
43016         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43017         obj_conv.is_owned = false;
43018         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
43019         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43020         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43021         CVec_u8Z_free(ret_var);
43022         return ret_arr;
43023 }
43024
43025 uint64_t  __attribute__((export_name("TS_TxAckRbf_read"))) TS_TxAckRbf_read(int8_tArray ser) {
43026         LDKu8slice ser_ref;
43027         ser_ref.datalen = ser->arr_len;
43028         ser_ref.data = ser->elems;
43029         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
43030         *ret_conv = TxAckRbf_read(ser_ref);
43031         FREE(ser);
43032         return tag_ptr(ret_conv, true);
43033 }
43034
43035 int8_tArray  __attribute__((export_name("TS_TxAbort_write"))) TS_TxAbort_write(uint64_t obj) {
43036         LDKTxAbort obj_conv;
43037         obj_conv.inner = untag_ptr(obj);
43038         obj_conv.is_owned = ptr_is_owned(obj);
43039         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43040         obj_conv.is_owned = false;
43041         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
43042         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43043         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43044         CVec_u8Z_free(ret_var);
43045         return ret_arr;
43046 }
43047
43048 uint64_t  __attribute__((export_name("TS_TxAbort_read"))) TS_TxAbort_read(int8_tArray ser) {
43049         LDKu8slice ser_ref;
43050         ser_ref.datalen = ser->arr_len;
43051         ser_ref.data = ser->elems;
43052         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
43053         *ret_conv = TxAbort_read(ser_ref);
43054         FREE(ser);
43055         return tag_ptr(ret_conv, true);
43056 }
43057
43058 int8_tArray  __attribute__((export_name("TS_AnnouncementSignatures_write"))) TS_AnnouncementSignatures_write(uint64_t obj) {
43059         LDKAnnouncementSignatures obj_conv;
43060         obj_conv.inner = untag_ptr(obj);
43061         obj_conv.is_owned = ptr_is_owned(obj);
43062         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43063         obj_conv.is_owned = false;
43064         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
43065         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43066         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43067         CVec_u8Z_free(ret_var);
43068         return ret_arr;
43069 }
43070
43071 uint64_t  __attribute__((export_name("TS_AnnouncementSignatures_read"))) TS_AnnouncementSignatures_read(int8_tArray ser) {
43072         LDKu8slice ser_ref;
43073         ser_ref.datalen = ser->arr_len;
43074         ser_ref.data = ser->elems;
43075         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
43076         *ret_conv = AnnouncementSignatures_read(ser_ref);
43077         FREE(ser);
43078         return tag_ptr(ret_conv, true);
43079 }
43080
43081 int8_tArray  __attribute__((export_name("TS_ChannelReestablish_write"))) TS_ChannelReestablish_write(uint64_t obj) {
43082         LDKChannelReestablish obj_conv;
43083         obj_conv.inner = untag_ptr(obj);
43084         obj_conv.is_owned = ptr_is_owned(obj);
43085         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43086         obj_conv.is_owned = false;
43087         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
43088         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43089         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43090         CVec_u8Z_free(ret_var);
43091         return ret_arr;
43092 }
43093
43094 uint64_t  __attribute__((export_name("TS_ChannelReestablish_read"))) TS_ChannelReestablish_read(int8_tArray ser) {
43095         LDKu8slice ser_ref;
43096         ser_ref.datalen = ser->arr_len;
43097         ser_ref.data = ser->elems;
43098         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
43099         *ret_conv = ChannelReestablish_read(ser_ref);
43100         FREE(ser);
43101         return tag_ptr(ret_conv, true);
43102 }
43103
43104 int8_tArray  __attribute__((export_name("TS_ClosingSigned_write"))) TS_ClosingSigned_write(uint64_t obj) {
43105         LDKClosingSigned obj_conv;
43106         obj_conv.inner = untag_ptr(obj);
43107         obj_conv.is_owned = ptr_is_owned(obj);
43108         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43109         obj_conv.is_owned = false;
43110         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
43111         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43112         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43113         CVec_u8Z_free(ret_var);
43114         return ret_arr;
43115 }
43116
43117 uint64_t  __attribute__((export_name("TS_ClosingSigned_read"))) TS_ClosingSigned_read(int8_tArray ser) {
43118         LDKu8slice ser_ref;
43119         ser_ref.datalen = ser->arr_len;
43120         ser_ref.data = ser->elems;
43121         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
43122         *ret_conv = ClosingSigned_read(ser_ref);
43123         FREE(ser);
43124         return tag_ptr(ret_conv, true);
43125 }
43126
43127 int8_tArray  __attribute__((export_name("TS_ClosingSignedFeeRange_write"))) TS_ClosingSignedFeeRange_write(uint64_t obj) {
43128         LDKClosingSignedFeeRange obj_conv;
43129         obj_conv.inner = untag_ptr(obj);
43130         obj_conv.is_owned = ptr_is_owned(obj);
43131         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43132         obj_conv.is_owned = false;
43133         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
43134         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43135         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43136         CVec_u8Z_free(ret_var);
43137         return ret_arr;
43138 }
43139
43140 uint64_t  __attribute__((export_name("TS_ClosingSignedFeeRange_read"))) TS_ClosingSignedFeeRange_read(int8_tArray ser) {
43141         LDKu8slice ser_ref;
43142         ser_ref.datalen = ser->arr_len;
43143         ser_ref.data = ser->elems;
43144         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
43145         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
43146         FREE(ser);
43147         return tag_ptr(ret_conv, true);
43148 }
43149
43150 int8_tArray  __attribute__((export_name("TS_CommitmentSigned_write"))) TS_CommitmentSigned_write(uint64_t obj) {
43151         LDKCommitmentSigned obj_conv;
43152         obj_conv.inner = untag_ptr(obj);
43153         obj_conv.is_owned = ptr_is_owned(obj);
43154         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43155         obj_conv.is_owned = false;
43156         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
43157         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43158         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43159         CVec_u8Z_free(ret_var);
43160         return ret_arr;
43161 }
43162
43163 uint64_t  __attribute__((export_name("TS_CommitmentSigned_read"))) TS_CommitmentSigned_read(int8_tArray ser) {
43164         LDKu8slice ser_ref;
43165         ser_ref.datalen = ser->arr_len;
43166         ser_ref.data = ser->elems;
43167         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
43168         *ret_conv = CommitmentSigned_read(ser_ref);
43169         FREE(ser);
43170         return tag_ptr(ret_conv, true);
43171 }
43172
43173 int8_tArray  __attribute__((export_name("TS_FundingCreated_write"))) TS_FundingCreated_write(uint64_t obj) {
43174         LDKFundingCreated obj_conv;
43175         obj_conv.inner = untag_ptr(obj);
43176         obj_conv.is_owned = ptr_is_owned(obj);
43177         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43178         obj_conv.is_owned = false;
43179         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
43180         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43181         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43182         CVec_u8Z_free(ret_var);
43183         return ret_arr;
43184 }
43185
43186 uint64_t  __attribute__((export_name("TS_FundingCreated_read"))) TS_FundingCreated_read(int8_tArray ser) {
43187         LDKu8slice ser_ref;
43188         ser_ref.datalen = ser->arr_len;
43189         ser_ref.data = ser->elems;
43190         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
43191         *ret_conv = FundingCreated_read(ser_ref);
43192         FREE(ser);
43193         return tag_ptr(ret_conv, true);
43194 }
43195
43196 int8_tArray  __attribute__((export_name("TS_FundingSigned_write"))) TS_FundingSigned_write(uint64_t obj) {
43197         LDKFundingSigned obj_conv;
43198         obj_conv.inner = untag_ptr(obj);
43199         obj_conv.is_owned = ptr_is_owned(obj);
43200         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43201         obj_conv.is_owned = false;
43202         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
43203         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43204         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43205         CVec_u8Z_free(ret_var);
43206         return ret_arr;
43207 }
43208
43209 uint64_t  __attribute__((export_name("TS_FundingSigned_read"))) TS_FundingSigned_read(int8_tArray ser) {
43210         LDKu8slice ser_ref;
43211         ser_ref.datalen = ser->arr_len;
43212         ser_ref.data = ser->elems;
43213         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
43214         *ret_conv = FundingSigned_read(ser_ref);
43215         FREE(ser);
43216         return tag_ptr(ret_conv, true);
43217 }
43218
43219 int8_tArray  __attribute__((export_name("TS_ChannelReady_write"))) TS_ChannelReady_write(uint64_t obj) {
43220         LDKChannelReady obj_conv;
43221         obj_conv.inner = untag_ptr(obj);
43222         obj_conv.is_owned = ptr_is_owned(obj);
43223         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43224         obj_conv.is_owned = false;
43225         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
43226         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43227         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43228         CVec_u8Z_free(ret_var);
43229         return ret_arr;
43230 }
43231
43232 uint64_t  __attribute__((export_name("TS_ChannelReady_read"))) TS_ChannelReady_read(int8_tArray ser) {
43233         LDKu8slice ser_ref;
43234         ser_ref.datalen = ser->arr_len;
43235         ser_ref.data = ser->elems;
43236         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
43237         *ret_conv = ChannelReady_read(ser_ref);
43238         FREE(ser);
43239         return tag_ptr(ret_conv, true);
43240 }
43241
43242 int8_tArray  __attribute__((export_name("TS_Init_write"))) TS_Init_write(uint64_t obj) {
43243         LDKInit obj_conv;
43244         obj_conv.inner = untag_ptr(obj);
43245         obj_conv.is_owned = ptr_is_owned(obj);
43246         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43247         obj_conv.is_owned = false;
43248         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
43249         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43250         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43251         CVec_u8Z_free(ret_var);
43252         return ret_arr;
43253 }
43254
43255 uint64_t  __attribute__((export_name("TS_Init_read"))) TS_Init_read(int8_tArray ser) {
43256         LDKu8slice ser_ref;
43257         ser_ref.datalen = ser->arr_len;
43258         ser_ref.data = ser->elems;
43259         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
43260         *ret_conv = Init_read(ser_ref);
43261         FREE(ser);
43262         return tag_ptr(ret_conv, true);
43263 }
43264
43265 int8_tArray  __attribute__((export_name("TS_OpenChannel_write"))) TS_OpenChannel_write(uint64_t obj) {
43266         LDKOpenChannel obj_conv;
43267         obj_conv.inner = untag_ptr(obj);
43268         obj_conv.is_owned = ptr_is_owned(obj);
43269         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43270         obj_conv.is_owned = false;
43271         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
43272         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43273         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43274         CVec_u8Z_free(ret_var);
43275         return ret_arr;
43276 }
43277
43278 uint64_t  __attribute__((export_name("TS_OpenChannel_read"))) TS_OpenChannel_read(int8_tArray ser) {
43279         LDKu8slice ser_ref;
43280         ser_ref.datalen = ser->arr_len;
43281         ser_ref.data = ser->elems;
43282         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
43283         *ret_conv = OpenChannel_read(ser_ref);
43284         FREE(ser);
43285         return tag_ptr(ret_conv, true);
43286 }
43287
43288 int8_tArray  __attribute__((export_name("TS_OpenChannelV2_write"))) TS_OpenChannelV2_write(uint64_t obj) {
43289         LDKOpenChannelV2 obj_conv;
43290         obj_conv.inner = untag_ptr(obj);
43291         obj_conv.is_owned = ptr_is_owned(obj);
43292         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43293         obj_conv.is_owned = false;
43294         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
43295         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43296         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43297         CVec_u8Z_free(ret_var);
43298         return ret_arr;
43299 }
43300
43301 uint64_t  __attribute__((export_name("TS_OpenChannelV2_read"))) TS_OpenChannelV2_read(int8_tArray ser) {
43302         LDKu8slice ser_ref;
43303         ser_ref.datalen = ser->arr_len;
43304         ser_ref.data = ser->elems;
43305         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
43306         *ret_conv = OpenChannelV2_read(ser_ref);
43307         FREE(ser);
43308         return tag_ptr(ret_conv, true);
43309 }
43310
43311 int8_tArray  __attribute__((export_name("TS_RevokeAndACK_write"))) TS_RevokeAndACK_write(uint64_t obj) {
43312         LDKRevokeAndACK obj_conv;
43313         obj_conv.inner = untag_ptr(obj);
43314         obj_conv.is_owned = ptr_is_owned(obj);
43315         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43316         obj_conv.is_owned = false;
43317         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
43318         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43319         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43320         CVec_u8Z_free(ret_var);
43321         return ret_arr;
43322 }
43323
43324 uint64_t  __attribute__((export_name("TS_RevokeAndACK_read"))) TS_RevokeAndACK_read(int8_tArray ser) {
43325         LDKu8slice ser_ref;
43326         ser_ref.datalen = ser->arr_len;
43327         ser_ref.data = ser->elems;
43328         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
43329         *ret_conv = RevokeAndACK_read(ser_ref);
43330         FREE(ser);
43331         return tag_ptr(ret_conv, true);
43332 }
43333
43334 int8_tArray  __attribute__((export_name("TS_Shutdown_write"))) TS_Shutdown_write(uint64_t obj) {
43335         LDKShutdown obj_conv;
43336         obj_conv.inner = untag_ptr(obj);
43337         obj_conv.is_owned = ptr_is_owned(obj);
43338         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43339         obj_conv.is_owned = false;
43340         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
43341         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43342         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43343         CVec_u8Z_free(ret_var);
43344         return ret_arr;
43345 }
43346
43347 uint64_t  __attribute__((export_name("TS_Shutdown_read"))) TS_Shutdown_read(int8_tArray ser) {
43348         LDKu8slice ser_ref;
43349         ser_ref.datalen = ser->arr_len;
43350         ser_ref.data = ser->elems;
43351         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
43352         *ret_conv = Shutdown_read(ser_ref);
43353         FREE(ser);
43354         return tag_ptr(ret_conv, true);
43355 }
43356
43357 int8_tArray  __attribute__((export_name("TS_UpdateFailHTLC_write"))) TS_UpdateFailHTLC_write(uint64_t obj) {
43358         LDKUpdateFailHTLC obj_conv;
43359         obj_conv.inner = untag_ptr(obj);
43360         obj_conv.is_owned = ptr_is_owned(obj);
43361         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43362         obj_conv.is_owned = false;
43363         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
43364         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43365         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43366         CVec_u8Z_free(ret_var);
43367         return ret_arr;
43368 }
43369
43370 uint64_t  __attribute__((export_name("TS_UpdateFailHTLC_read"))) TS_UpdateFailHTLC_read(int8_tArray ser) {
43371         LDKu8slice ser_ref;
43372         ser_ref.datalen = ser->arr_len;
43373         ser_ref.data = ser->elems;
43374         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
43375         *ret_conv = UpdateFailHTLC_read(ser_ref);
43376         FREE(ser);
43377         return tag_ptr(ret_conv, true);
43378 }
43379
43380 int8_tArray  __attribute__((export_name("TS_UpdateFailMalformedHTLC_write"))) TS_UpdateFailMalformedHTLC_write(uint64_t obj) {
43381         LDKUpdateFailMalformedHTLC obj_conv;
43382         obj_conv.inner = untag_ptr(obj);
43383         obj_conv.is_owned = ptr_is_owned(obj);
43384         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43385         obj_conv.is_owned = false;
43386         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
43387         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43388         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43389         CVec_u8Z_free(ret_var);
43390         return ret_arr;
43391 }
43392
43393 uint64_t  __attribute__((export_name("TS_UpdateFailMalformedHTLC_read"))) TS_UpdateFailMalformedHTLC_read(int8_tArray ser) {
43394         LDKu8slice ser_ref;
43395         ser_ref.datalen = ser->arr_len;
43396         ser_ref.data = ser->elems;
43397         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
43398         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
43399         FREE(ser);
43400         return tag_ptr(ret_conv, true);
43401 }
43402
43403 int8_tArray  __attribute__((export_name("TS_UpdateFee_write"))) TS_UpdateFee_write(uint64_t obj) {
43404         LDKUpdateFee obj_conv;
43405         obj_conv.inner = untag_ptr(obj);
43406         obj_conv.is_owned = ptr_is_owned(obj);
43407         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43408         obj_conv.is_owned = false;
43409         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
43410         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43411         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43412         CVec_u8Z_free(ret_var);
43413         return ret_arr;
43414 }
43415
43416 uint64_t  __attribute__((export_name("TS_UpdateFee_read"))) TS_UpdateFee_read(int8_tArray ser) {
43417         LDKu8slice ser_ref;
43418         ser_ref.datalen = ser->arr_len;
43419         ser_ref.data = ser->elems;
43420         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
43421         *ret_conv = UpdateFee_read(ser_ref);
43422         FREE(ser);
43423         return tag_ptr(ret_conv, true);
43424 }
43425
43426 int8_tArray  __attribute__((export_name("TS_UpdateFulfillHTLC_write"))) TS_UpdateFulfillHTLC_write(uint64_t obj) {
43427         LDKUpdateFulfillHTLC obj_conv;
43428         obj_conv.inner = untag_ptr(obj);
43429         obj_conv.is_owned = ptr_is_owned(obj);
43430         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43431         obj_conv.is_owned = false;
43432         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
43433         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43434         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43435         CVec_u8Z_free(ret_var);
43436         return ret_arr;
43437 }
43438
43439 uint64_t  __attribute__((export_name("TS_UpdateFulfillHTLC_read"))) TS_UpdateFulfillHTLC_read(int8_tArray ser) {
43440         LDKu8slice ser_ref;
43441         ser_ref.datalen = ser->arr_len;
43442         ser_ref.data = ser->elems;
43443         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
43444         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
43445         FREE(ser);
43446         return tag_ptr(ret_conv, true);
43447 }
43448
43449 int8_tArray  __attribute__((export_name("TS_UpdateAddHTLC_write"))) TS_UpdateAddHTLC_write(uint64_t obj) {
43450         LDKUpdateAddHTLC obj_conv;
43451         obj_conv.inner = untag_ptr(obj);
43452         obj_conv.is_owned = ptr_is_owned(obj);
43453         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43454         obj_conv.is_owned = false;
43455         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
43456         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43457         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43458         CVec_u8Z_free(ret_var);
43459         return ret_arr;
43460 }
43461
43462 uint64_t  __attribute__((export_name("TS_UpdateAddHTLC_read"))) TS_UpdateAddHTLC_read(int8_tArray ser) {
43463         LDKu8slice ser_ref;
43464         ser_ref.datalen = ser->arr_len;
43465         ser_ref.data = ser->elems;
43466         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
43467         *ret_conv = UpdateAddHTLC_read(ser_ref);
43468         FREE(ser);
43469         return tag_ptr(ret_conv, true);
43470 }
43471
43472 uint64_t  __attribute__((export_name("TS_OnionMessage_read"))) TS_OnionMessage_read(int8_tArray ser) {
43473         LDKu8slice ser_ref;
43474         ser_ref.datalen = ser->arr_len;
43475         ser_ref.data = ser->elems;
43476         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
43477         *ret_conv = OnionMessage_read(ser_ref);
43478         FREE(ser);
43479         return tag_ptr(ret_conv, true);
43480 }
43481
43482 int8_tArray  __attribute__((export_name("TS_OnionMessage_write"))) TS_OnionMessage_write(uint64_t obj) {
43483         LDKOnionMessage obj_conv;
43484         obj_conv.inner = untag_ptr(obj);
43485         obj_conv.is_owned = ptr_is_owned(obj);
43486         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43487         obj_conv.is_owned = false;
43488         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
43489         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43490         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43491         CVec_u8Z_free(ret_var);
43492         return ret_arr;
43493 }
43494
43495 int8_tArray  __attribute__((export_name("TS_Ping_write"))) TS_Ping_write(uint64_t obj) {
43496         LDKPing obj_conv;
43497         obj_conv.inner = untag_ptr(obj);
43498         obj_conv.is_owned = ptr_is_owned(obj);
43499         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43500         obj_conv.is_owned = false;
43501         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
43502         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43503         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43504         CVec_u8Z_free(ret_var);
43505         return ret_arr;
43506 }
43507
43508 uint64_t  __attribute__((export_name("TS_Ping_read"))) TS_Ping_read(int8_tArray ser) {
43509         LDKu8slice ser_ref;
43510         ser_ref.datalen = ser->arr_len;
43511         ser_ref.data = ser->elems;
43512         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
43513         *ret_conv = Ping_read(ser_ref);
43514         FREE(ser);
43515         return tag_ptr(ret_conv, true);
43516 }
43517
43518 int8_tArray  __attribute__((export_name("TS_Pong_write"))) TS_Pong_write(uint64_t obj) {
43519         LDKPong obj_conv;
43520         obj_conv.inner = untag_ptr(obj);
43521         obj_conv.is_owned = ptr_is_owned(obj);
43522         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43523         obj_conv.is_owned = false;
43524         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
43525         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43526         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43527         CVec_u8Z_free(ret_var);
43528         return ret_arr;
43529 }
43530
43531 uint64_t  __attribute__((export_name("TS_Pong_read"))) TS_Pong_read(int8_tArray ser) {
43532         LDKu8slice ser_ref;
43533         ser_ref.datalen = ser->arr_len;
43534         ser_ref.data = ser->elems;
43535         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
43536         *ret_conv = Pong_read(ser_ref);
43537         FREE(ser);
43538         return tag_ptr(ret_conv, true);
43539 }
43540
43541 int8_tArray  __attribute__((export_name("TS_UnsignedChannelAnnouncement_write"))) TS_UnsignedChannelAnnouncement_write(uint64_t obj) {
43542         LDKUnsignedChannelAnnouncement obj_conv;
43543         obj_conv.inner = untag_ptr(obj);
43544         obj_conv.is_owned = ptr_is_owned(obj);
43545         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43546         obj_conv.is_owned = false;
43547         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
43548         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43549         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43550         CVec_u8Z_free(ret_var);
43551         return ret_arr;
43552 }
43553
43554 uint64_t  __attribute__((export_name("TS_UnsignedChannelAnnouncement_read"))) TS_UnsignedChannelAnnouncement_read(int8_tArray ser) {
43555         LDKu8slice ser_ref;
43556         ser_ref.datalen = ser->arr_len;
43557         ser_ref.data = ser->elems;
43558         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
43559         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
43560         FREE(ser);
43561         return tag_ptr(ret_conv, true);
43562 }
43563
43564 int8_tArray  __attribute__((export_name("TS_ChannelAnnouncement_write"))) TS_ChannelAnnouncement_write(uint64_t obj) {
43565         LDKChannelAnnouncement obj_conv;
43566         obj_conv.inner = untag_ptr(obj);
43567         obj_conv.is_owned = ptr_is_owned(obj);
43568         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43569         obj_conv.is_owned = false;
43570         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
43571         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43572         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43573         CVec_u8Z_free(ret_var);
43574         return ret_arr;
43575 }
43576
43577 uint64_t  __attribute__((export_name("TS_ChannelAnnouncement_read"))) TS_ChannelAnnouncement_read(int8_tArray ser) {
43578         LDKu8slice ser_ref;
43579         ser_ref.datalen = ser->arr_len;
43580         ser_ref.data = ser->elems;
43581         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
43582         *ret_conv = ChannelAnnouncement_read(ser_ref);
43583         FREE(ser);
43584         return tag_ptr(ret_conv, true);
43585 }
43586
43587 int8_tArray  __attribute__((export_name("TS_UnsignedChannelUpdate_write"))) TS_UnsignedChannelUpdate_write(uint64_t obj) {
43588         LDKUnsignedChannelUpdate obj_conv;
43589         obj_conv.inner = untag_ptr(obj);
43590         obj_conv.is_owned = ptr_is_owned(obj);
43591         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43592         obj_conv.is_owned = false;
43593         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
43594         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43595         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43596         CVec_u8Z_free(ret_var);
43597         return ret_arr;
43598 }
43599
43600 uint64_t  __attribute__((export_name("TS_UnsignedChannelUpdate_read"))) TS_UnsignedChannelUpdate_read(int8_tArray ser) {
43601         LDKu8slice ser_ref;
43602         ser_ref.datalen = ser->arr_len;
43603         ser_ref.data = ser->elems;
43604         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
43605         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
43606         FREE(ser);
43607         return tag_ptr(ret_conv, true);
43608 }
43609
43610 int8_tArray  __attribute__((export_name("TS_ChannelUpdate_write"))) TS_ChannelUpdate_write(uint64_t obj) {
43611         LDKChannelUpdate obj_conv;
43612         obj_conv.inner = untag_ptr(obj);
43613         obj_conv.is_owned = ptr_is_owned(obj);
43614         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43615         obj_conv.is_owned = false;
43616         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
43617         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43618         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43619         CVec_u8Z_free(ret_var);
43620         return ret_arr;
43621 }
43622
43623 uint64_t  __attribute__((export_name("TS_ChannelUpdate_read"))) TS_ChannelUpdate_read(int8_tArray ser) {
43624         LDKu8slice ser_ref;
43625         ser_ref.datalen = ser->arr_len;
43626         ser_ref.data = ser->elems;
43627         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
43628         *ret_conv = ChannelUpdate_read(ser_ref);
43629         FREE(ser);
43630         return tag_ptr(ret_conv, true);
43631 }
43632
43633 int8_tArray  __attribute__((export_name("TS_ErrorMessage_write"))) TS_ErrorMessage_write(uint64_t obj) {
43634         LDKErrorMessage obj_conv;
43635         obj_conv.inner = untag_ptr(obj);
43636         obj_conv.is_owned = ptr_is_owned(obj);
43637         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43638         obj_conv.is_owned = false;
43639         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
43640         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43641         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43642         CVec_u8Z_free(ret_var);
43643         return ret_arr;
43644 }
43645
43646 uint64_t  __attribute__((export_name("TS_ErrorMessage_read"))) TS_ErrorMessage_read(int8_tArray ser) {
43647         LDKu8slice ser_ref;
43648         ser_ref.datalen = ser->arr_len;
43649         ser_ref.data = ser->elems;
43650         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
43651         *ret_conv = ErrorMessage_read(ser_ref);
43652         FREE(ser);
43653         return tag_ptr(ret_conv, true);
43654 }
43655
43656 int8_tArray  __attribute__((export_name("TS_WarningMessage_write"))) TS_WarningMessage_write(uint64_t obj) {
43657         LDKWarningMessage obj_conv;
43658         obj_conv.inner = untag_ptr(obj);
43659         obj_conv.is_owned = ptr_is_owned(obj);
43660         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43661         obj_conv.is_owned = false;
43662         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
43663         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43664         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43665         CVec_u8Z_free(ret_var);
43666         return ret_arr;
43667 }
43668
43669 uint64_t  __attribute__((export_name("TS_WarningMessage_read"))) TS_WarningMessage_read(int8_tArray ser) {
43670         LDKu8slice ser_ref;
43671         ser_ref.datalen = ser->arr_len;
43672         ser_ref.data = ser->elems;
43673         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
43674         *ret_conv = WarningMessage_read(ser_ref);
43675         FREE(ser);
43676         return tag_ptr(ret_conv, true);
43677 }
43678
43679 int8_tArray  __attribute__((export_name("TS_UnsignedNodeAnnouncement_write"))) TS_UnsignedNodeAnnouncement_write(uint64_t obj) {
43680         LDKUnsignedNodeAnnouncement obj_conv;
43681         obj_conv.inner = untag_ptr(obj);
43682         obj_conv.is_owned = ptr_is_owned(obj);
43683         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43684         obj_conv.is_owned = false;
43685         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
43686         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43687         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43688         CVec_u8Z_free(ret_var);
43689         return ret_arr;
43690 }
43691
43692 uint64_t  __attribute__((export_name("TS_UnsignedNodeAnnouncement_read"))) TS_UnsignedNodeAnnouncement_read(int8_tArray ser) {
43693         LDKu8slice ser_ref;
43694         ser_ref.datalen = ser->arr_len;
43695         ser_ref.data = ser->elems;
43696         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
43697         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
43698         FREE(ser);
43699         return tag_ptr(ret_conv, true);
43700 }
43701
43702 int8_tArray  __attribute__((export_name("TS_NodeAnnouncement_write"))) TS_NodeAnnouncement_write(uint64_t obj) {
43703         LDKNodeAnnouncement obj_conv;
43704         obj_conv.inner = untag_ptr(obj);
43705         obj_conv.is_owned = ptr_is_owned(obj);
43706         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43707         obj_conv.is_owned = false;
43708         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
43709         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43710         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43711         CVec_u8Z_free(ret_var);
43712         return ret_arr;
43713 }
43714
43715 uint64_t  __attribute__((export_name("TS_NodeAnnouncement_read"))) TS_NodeAnnouncement_read(int8_tArray ser) {
43716         LDKu8slice ser_ref;
43717         ser_ref.datalen = ser->arr_len;
43718         ser_ref.data = ser->elems;
43719         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
43720         *ret_conv = NodeAnnouncement_read(ser_ref);
43721         FREE(ser);
43722         return tag_ptr(ret_conv, true);
43723 }
43724
43725 uint64_t  __attribute__((export_name("TS_QueryShortChannelIds_read"))) TS_QueryShortChannelIds_read(int8_tArray ser) {
43726         LDKu8slice ser_ref;
43727         ser_ref.datalen = ser->arr_len;
43728         ser_ref.data = ser->elems;
43729         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
43730         *ret_conv = QueryShortChannelIds_read(ser_ref);
43731         FREE(ser);
43732         return tag_ptr(ret_conv, true);
43733 }
43734
43735 int8_tArray  __attribute__((export_name("TS_QueryShortChannelIds_write"))) TS_QueryShortChannelIds_write(uint64_t obj) {
43736         LDKQueryShortChannelIds obj_conv;
43737         obj_conv.inner = untag_ptr(obj);
43738         obj_conv.is_owned = ptr_is_owned(obj);
43739         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43740         obj_conv.is_owned = false;
43741         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
43742         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43743         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43744         CVec_u8Z_free(ret_var);
43745         return ret_arr;
43746 }
43747
43748 int8_tArray  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_write"))) TS_ReplyShortChannelIdsEnd_write(uint64_t obj) {
43749         LDKReplyShortChannelIdsEnd obj_conv;
43750         obj_conv.inner = untag_ptr(obj);
43751         obj_conv.is_owned = ptr_is_owned(obj);
43752         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43753         obj_conv.is_owned = false;
43754         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
43755         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43756         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43757         CVec_u8Z_free(ret_var);
43758         return ret_arr;
43759 }
43760
43761 uint64_t  __attribute__((export_name("TS_ReplyShortChannelIdsEnd_read"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
43762         LDKu8slice ser_ref;
43763         ser_ref.datalen = ser->arr_len;
43764         ser_ref.data = ser->elems;
43765         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
43766         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
43767         FREE(ser);
43768         return tag_ptr(ret_conv, true);
43769 }
43770
43771 int32_t  __attribute__((export_name("TS_QueryChannelRange_end_blocknum"))) TS_QueryChannelRange_end_blocknum(uint64_t this_arg) {
43772         LDKQueryChannelRange this_arg_conv;
43773         this_arg_conv.inner = untag_ptr(this_arg);
43774         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43775         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43776         this_arg_conv.is_owned = false;
43777         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
43778         return ret_conv;
43779 }
43780
43781 int8_tArray  __attribute__((export_name("TS_QueryChannelRange_write"))) TS_QueryChannelRange_write(uint64_t obj) {
43782         LDKQueryChannelRange obj_conv;
43783         obj_conv.inner = untag_ptr(obj);
43784         obj_conv.is_owned = ptr_is_owned(obj);
43785         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43786         obj_conv.is_owned = false;
43787         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
43788         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43789         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43790         CVec_u8Z_free(ret_var);
43791         return ret_arr;
43792 }
43793
43794 uint64_t  __attribute__((export_name("TS_QueryChannelRange_read"))) TS_QueryChannelRange_read(int8_tArray ser) {
43795         LDKu8slice ser_ref;
43796         ser_ref.datalen = ser->arr_len;
43797         ser_ref.data = ser->elems;
43798         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
43799         *ret_conv = QueryChannelRange_read(ser_ref);
43800         FREE(ser);
43801         return tag_ptr(ret_conv, true);
43802 }
43803
43804 uint64_t  __attribute__((export_name("TS_ReplyChannelRange_read"))) TS_ReplyChannelRange_read(int8_tArray ser) {
43805         LDKu8slice ser_ref;
43806         ser_ref.datalen = ser->arr_len;
43807         ser_ref.data = ser->elems;
43808         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
43809         *ret_conv = ReplyChannelRange_read(ser_ref);
43810         FREE(ser);
43811         return tag_ptr(ret_conv, true);
43812 }
43813
43814 int8_tArray  __attribute__((export_name("TS_ReplyChannelRange_write"))) TS_ReplyChannelRange_write(uint64_t obj) {
43815         LDKReplyChannelRange obj_conv;
43816         obj_conv.inner = untag_ptr(obj);
43817         obj_conv.is_owned = ptr_is_owned(obj);
43818         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43819         obj_conv.is_owned = false;
43820         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
43821         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43822         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43823         CVec_u8Z_free(ret_var);
43824         return ret_arr;
43825 }
43826
43827 int8_tArray  __attribute__((export_name("TS_GossipTimestampFilter_write"))) TS_GossipTimestampFilter_write(uint64_t obj) {
43828         LDKGossipTimestampFilter obj_conv;
43829         obj_conv.inner = untag_ptr(obj);
43830         obj_conv.is_owned = ptr_is_owned(obj);
43831         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43832         obj_conv.is_owned = false;
43833         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
43834         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
43835         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
43836         CVec_u8Z_free(ret_var);
43837         return ret_arr;
43838 }
43839
43840 uint64_t  __attribute__((export_name("TS_GossipTimestampFilter_read"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
43841         LDKu8slice ser_ref;
43842         ser_ref.datalen = ser->arr_len;
43843         ser_ref.data = ser->elems;
43844         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
43845         *ret_conv = GossipTimestampFilter_read(ser_ref);
43846         FREE(ser);
43847         return tag_ptr(ret_conv, true);
43848 }
43849
43850 void  __attribute__((export_name("TS_CustomMessageHandler_free"))) TS_CustomMessageHandler_free(uint64_t this_ptr) {
43851         if (!ptr_is_owned(this_ptr)) return;
43852         void* this_ptr_ptr = untag_ptr(this_ptr);
43853         CHECK_ACCESS(this_ptr_ptr);
43854         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
43855         FREE(untag_ptr(this_ptr));
43856         CustomMessageHandler_free(this_ptr_conv);
43857 }
43858
43859 void  __attribute__((export_name("TS_IgnoringMessageHandler_free"))) TS_IgnoringMessageHandler_free(uint64_t this_obj) {
43860         LDKIgnoringMessageHandler this_obj_conv;
43861         this_obj_conv.inner = untag_ptr(this_obj);
43862         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43864         IgnoringMessageHandler_free(this_obj_conv);
43865 }
43866
43867 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_new"))) TS_IgnoringMessageHandler_new() {
43868         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
43869         uint64_t ret_ref = 0;
43870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43872         return ret_ref;
43873 }
43874
43875 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_MessageSendEventsProvider"))) TS_IgnoringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
43876         LDKIgnoringMessageHandler this_arg_conv;
43877         this_arg_conv.inner = untag_ptr(this_arg);
43878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43880         this_arg_conv.is_owned = false;
43881         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43882         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
43883         return tag_ptr(ret_ret, true);
43884 }
43885
43886 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_RoutingMessageHandler"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint64_t this_arg) {
43887         LDKIgnoringMessageHandler this_arg_conv;
43888         this_arg_conv.inner = untag_ptr(this_arg);
43889         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43891         this_arg_conv.is_owned = false;
43892         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
43893         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
43894         return tag_ptr(ret_ret, true);
43895 }
43896
43897 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageProvider"))) TS_IgnoringMessageHandler_as_OnionMessageProvider(uint64_t this_arg) {
43898         LDKIgnoringMessageHandler this_arg_conv;
43899         this_arg_conv.inner = untag_ptr(this_arg);
43900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43902         this_arg_conv.is_owned = false;
43903         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
43904         *ret_ret = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv);
43905         return tag_ptr(ret_ret, true);
43906 }
43907
43908 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OnionMessageHandler"))) TS_IgnoringMessageHandler_as_OnionMessageHandler(uint64_t this_arg) {
43909         LDKIgnoringMessageHandler this_arg_conv;
43910         this_arg_conv.inner = untag_ptr(this_arg);
43911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43913         this_arg_conv.is_owned = false;
43914         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
43915         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
43916         return tag_ptr(ret_ret, true);
43917 }
43918
43919 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_OffersMessageHandler"))) TS_IgnoringMessageHandler_as_OffersMessageHandler(uint64_t this_arg) {
43920         LDKIgnoringMessageHandler this_arg_conv;
43921         this_arg_conv.inner = untag_ptr(this_arg);
43922         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43924         this_arg_conv.is_owned = false;
43925         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
43926         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
43927         return tag_ptr(ret_ret, true);
43928 }
43929
43930 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomOnionMessageHandler"))) TS_IgnoringMessageHandler_as_CustomOnionMessageHandler(uint64_t this_arg) {
43931         LDKIgnoringMessageHandler this_arg_conv;
43932         this_arg_conv.inner = untag_ptr(this_arg);
43933         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43935         this_arg_conv.is_owned = false;
43936         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
43937         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
43938         return tag_ptr(ret_ret, true);
43939 }
43940
43941 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageReader"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint64_t this_arg) {
43942         LDKIgnoringMessageHandler this_arg_conv;
43943         this_arg_conv.inner = untag_ptr(this_arg);
43944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43946         this_arg_conv.is_owned = false;
43947         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
43948         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
43949         return tag_ptr(ret_ret, true);
43950 }
43951
43952 uint64_t  __attribute__((export_name("TS_IgnoringMessageHandler_as_CustomMessageHandler"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint64_t this_arg) {
43953         LDKIgnoringMessageHandler this_arg_conv;
43954         this_arg_conv.inner = untag_ptr(this_arg);
43955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43957         this_arg_conv.is_owned = false;
43958         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
43959         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
43960         return tag_ptr(ret_ret, true);
43961 }
43962
43963 void  __attribute__((export_name("TS_ErroringMessageHandler_free"))) TS_ErroringMessageHandler_free(uint64_t this_obj) {
43964         LDKErroringMessageHandler this_obj_conv;
43965         this_obj_conv.inner = untag_ptr(this_obj);
43966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43968         ErroringMessageHandler_free(this_obj_conv);
43969 }
43970
43971 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_new"))) TS_ErroringMessageHandler_new() {
43972         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
43973         uint64_t ret_ref = 0;
43974         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43975         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43976         return ret_ref;
43977 }
43978
43979 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_MessageSendEventsProvider"))) TS_ErroringMessageHandler_as_MessageSendEventsProvider(uint64_t this_arg) {
43980         LDKErroringMessageHandler this_arg_conv;
43981         this_arg_conv.inner = untag_ptr(this_arg);
43982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43984         this_arg_conv.is_owned = false;
43985         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
43986         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
43987         return tag_ptr(ret_ret, true);
43988 }
43989
43990 uint64_t  __attribute__((export_name("TS_ErroringMessageHandler_as_ChannelMessageHandler"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint64_t this_arg) {
43991         LDKErroringMessageHandler this_arg_conv;
43992         this_arg_conv.inner = untag_ptr(this_arg);
43993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43995         this_arg_conv.is_owned = false;
43996         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
43997         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
43998         return tag_ptr(ret_ret, true);
43999 }
44000
44001 void  __attribute__((export_name("TS_MessageHandler_free"))) TS_MessageHandler_free(uint64_t this_obj) {
44002         LDKMessageHandler 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         MessageHandler_free(this_obj_conv);
44007 }
44008
44009 uint64_t  __attribute__((export_name("TS_MessageHandler_get_chan_handler"))) TS_MessageHandler_get_chan_handler(uint64_t this_ptr) {
44010         LDKMessageHandler 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         // WARNING: This object doesn't live past this scope, needs clone!
44016         uint64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
44017         return ret_ret;
44018 }
44019
44020 void  __attribute__((export_name("TS_MessageHandler_set_chan_handler"))) TS_MessageHandler_set_chan_handler(uint64_t this_ptr, uint64_t val) {
44021         LDKMessageHandler 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         void* val_ptr = untag_ptr(val);
44027         CHECK_ACCESS(val_ptr);
44028         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
44029         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
44030                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44031                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
44032         }
44033         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
44034 }
44035
44036 uint64_t  __attribute__((export_name("TS_MessageHandler_get_route_handler"))) TS_MessageHandler_get_route_handler(uint64_t this_ptr) {
44037         LDKMessageHandler this_ptr_conv;
44038         this_ptr_conv.inner = untag_ptr(this_ptr);
44039         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44041         this_ptr_conv.is_owned = false;
44042         // WARNING: This object doesn't live past this scope, needs clone!
44043         uint64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
44044         return ret_ret;
44045 }
44046
44047 void  __attribute__((export_name("TS_MessageHandler_set_route_handler"))) TS_MessageHandler_set_route_handler(uint64_t this_ptr, uint64_t val) {
44048         LDKMessageHandler this_ptr_conv;
44049         this_ptr_conv.inner = untag_ptr(this_ptr);
44050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44052         this_ptr_conv.is_owned = false;
44053         void* val_ptr = untag_ptr(val);
44054         CHECK_ACCESS(val_ptr);
44055         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
44056         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
44057                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44058                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
44059         }
44060         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
44061 }
44062
44063 uint64_t  __attribute__((export_name("TS_MessageHandler_get_onion_message_handler"))) TS_MessageHandler_get_onion_message_handler(uint64_t this_ptr) {
44064         LDKMessageHandler this_ptr_conv;
44065         this_ptr_conv.inner = untag_ptr(this_ptr);
44066         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44067         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44068         this_ptr_conv.is_owned = false;
44069         // WARNING: This object doesn't live past this scope, needs clone!
44070         uint64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
44071         return ret_ret;
44072 }
44073
44074 void  __attribute__((export_name("TS_MessageHandler_set_onion_message_handler"))) TS_MessageHandler_set_onion_message_handler(uint64_t this_ptr, uint64_t val) {
44075         LDKMessageHandler this_ptr_conv;
44076         this_ptr_conv.inner = untag_ptr(this_ptr);
44077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44079         this_ptr_conv.is_owned = false;
44080         void* val_ptr = untag_ptr(val);
44081         CHECK_ACCESS(val_ptr);
44082         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
44083         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
44084                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44085                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
44086         }
44087         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
44088 }
44089
44090 uint64_t  __attribute__((export_name("TS_MessageHandler_get_custom_message_handler"))) TS_MessageHandler_get_custom_message_handler(uint64_t this_ptr) {
44091         LDKMessageHandler this_ptr_conv;
44092         this_ptr_conv.inner = untag_ptr(this_ptr);
44093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44095         this_ptr_conv.is_owned = false;
44096         // WARNING: This object doesn't live past this scope, needs clone!
44097         uint64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
44098         return ret_ret;
44099 }
44100
44101 void  __attribute__((export_name("TS_MessageHandler_set_custom_message_handler"))) TS_MessageHandler_set_custom_message_handler(uint64_t this_ptr, uint64_t val) {
44102         LDKMessageHandler this_ptr_conv;
44103         this_ptr_conv.inner = untag_ptr(this_ptr);
44104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44106         this_ptr_conv.is_owned = false;
44107         void* val_ptr = untag_ptr(val);
44108         CHECK_ACCESS(val_ptr);
44109         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
44110         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
44111                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44112                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
44113         }
44114         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
44115 }
44116
44117 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) {
44118         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
44119         CHECK_ACCESS(chan_handler_arg_ptr);
44120         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
44121         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
44122                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44123                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
44124         }
44125         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
44126         CHECK_ACCESS(route_handler_arg_ptr);
44127         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
44128         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
44129                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44130                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
44131         }
44132         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
44133         CHECK_ACCESS(onion_message_handler_arg_ptr);
44134         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
44135         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
44136                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44137                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
44138         }
44139         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
44140         CHECK_ACCESS(custom_message_handler_arg_ptr);
44141         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
44142         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
44143                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44144                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
44145         }
44146         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
44147         uint64_t ret_ref = 0;
44148         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44149         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44150         return ret_ref;
44151 }
44152
44153 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
44154         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
44155         *ret_ret = SocketDescriptor_clone(arg);
44156         return tag_ptr(ret_ret, true);
44157 }
44158 int64_t  __attribute__((export_name("TS_SocketDescriptor_clone_ptr"))) TS_SocketDescriptor_clone_ptr(uint64_t arg) {
44159         void* arg_ptr = untag_ptr(arg);
44160         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
44161         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
44162         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
44163         return ret_conv;
44164 }
44165
44166 uint64_t  __attribute__((export_name("TS_SocketDescriptor_clone"))) TS_SocketDescriptor_clone(uint64_t orig) {
44167         void* orig_ptr = untag_ptr(orig);
44168         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
44169         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
44170         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
44171         *ret_ret = SocketDescriptor_clone(orig_conv);
44172         return tag_ptr(ret_ret, true);
44173 }
44174
44175 void  __attribute__((export_name("TS_SocketDescriptor_free"))) TS_SocketDescriptor_free(uint64_t this_ptr) {
44176         if (!ptr_is_owned(this_ptr)) return;
44177         void* this_ptr_ptr = untag_ptr(this_ptr);
44178         CHECK_ACCESS(this_ptr_ptr);
44179         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
44180         FREE(untag_ptr(this_ptr));
44181         SocketDescriptor_free(this_ptr_conv);
44182 }
44183
44184 void  __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError_free(uint64_t this_obj) {
44185         LDKPeerHandleError this_obj_conv;
44186         this_obj_conv.inner = untag_ptr(this_obj);
44187         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44189         PeerHandleError_free(this_obj_conv);
44190 }
44191
44192 uint64_t  __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() {
44193         LDKPeerHandleError ret_var = PeerHandleError_new();
44194         uint64_t ret_ref = 0;
44195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44197         return ret_ref;
44198 }
44199
44200 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
44201         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
44202         uint64_t ret_ref = 0;
44203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44205         return ret_ref;
44206 }
44207 int64_t  __attribute__((export_name("TS_PeerHandleError_clone_ptr"))) TS_PeerHandleError_clone_ptr(uint64_t arg) {
44208         LDKPeerHandleError arg_conv;
44209         arg_conv.inner = untag_ptr(arg);
44210         arg_conv.is_owned = ptr_is_owned(arg);
44211         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44212         arg_conv.is_owned = false;
44213         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
44214         return ret_conv;
44215 }
44216
44217 uint64_t  __attribute__((export_name("TS_PeerHandleError_clone"))) TS_PeerHandleError_clone(uint64_t orig) {
44218         LDKPeerHandleError orig_conv;
44219         orig_conv.inner = untag_ptr(orig);
44220         orig_conv.is_owned = ptr_is_owned(orig);
44221         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44222         orig_conv.is_owned = false;
44223         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
44224         uint64_t ret_ref = 0;
44225         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44226         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44227         return ret_ref;
44228 }
44229
44230 void  __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(uint64_t this_obj) {
44231         LDKPeerManager this_obj_conv;
44232         this_obj_conv.inner = untag_ptr(this_obj);
44233         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44235         PeerManager_free(this_obj_conv);
44236 }
44237
44238 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) {
44239         LDKMessageHandler message_handler_conv;
44240         message_handler_conv.inner = untag_ptr(message_handler);
44241         message_handler_conv.is_owned = ptr_is_owned(message_handler);
44242         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
44243         // WARNING: we need a move here but no clone is available for LDKMessageHandler
44244         
44245         uint8_t ephemeral_random_data_arr[32];
44246         CHECK(ephemeral_random_data->arr_len == 32);
44247         memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data);
44248         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
44249         void* logger_ptr = untag_ptr(logger);
44250         CHECK_ACCESS(logger_ptr);
44251         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44252         if (logger_conv.free == LDKLogger_JCalls_free) {
44253                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44254                 LDKLogger_JCalls_cloned(&logger_conv);
44255         }
44256         void* node_signer_ptr = untag_ptr(node_signer);
44257         CHECK_ACCESS(node_signer_ptr);
44258         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
44259         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
44260                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44261                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
44262         }
44263         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
44264         uint64_t ret_ref = 0;
44265         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44266         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44267         return ret_ref;
44268 }
44269
44270 uint64_tArray  __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) {
44271         LDKPeerManager this_arg_conv;
44272         this_arg_conv.inner = untag_ptr(this_arg);
44273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44275         this_arg_conv.is_owned = false;
44276         LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
44277         uint64_tArray ret_arr = NULL;
44278         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
44279         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
44280         for (size_t o = 0; o < ret_var.datalen; o++) {
44281                 LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ");
44282                 *ret_conv_40_conv = ret_var.data[o];
44283                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
44284         }
44285         
44286         FREE(ret_var.data);
44287         return ret_arr;
44288 }
44289
44290 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) {
44291         LDKPeerManager this_arg_conv;
44292         this_arg_conv.inner = untag_ptr(this_arg);
44293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44295         this_arg_conv.is_owned = false;
44296         LDKPublicKey their_node_id_ref;
44297         CHECK(their_node_id->arr_len == 33);
44298         memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id);
44299         void* descriptor_ptr = untag_ptr(descriptor);
44300         CHECK_ACCESS(descriptor_ptr);
44301         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
44302         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
44303                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44304                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
44305         }
44306         void* remote_network_address_ptr = untag_ptr(remote_network_address);
44307         CHECK_ACCESS(remote_network_address_ptr);
44308         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
44309         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
44310         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
44311         return tag_ptr(ret_conv, true);
44312 }
44313
44314 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) {
44315         LDKPeerManager this_arg_conv;
44316         this_arg_conv.inner = untag_ptr(this_arg);
44317         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44319         this_arg_conv.is_owned = false;
44320         void* descriptor_ptr = untag_ptr(descriptor);
44321         CHECK_ACCESS(descriptor_ptr);
44322         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
44323         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
44324                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44325                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
44326         }
44327         void* remote_network_address_ptr = untag_ptr(remote_network_address);
44328         CHECK_ACCESS(remote_network_address_ptr);
44329         LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr);
44330         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
44331         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
44332         return tag_ptr(ret_conv, true);
44333 }
44334
44335 uint64_t  __attribute__((export_name("TS_PeerManager_write_buffer_space_avail"))) TS_PeerManager_write_buffer_space_avail(uint64_t this_arg, uint64_t descriptor) {
44336         LDKPeerManager this_arg_conv;
44337         this_arg_conv.inner = untag_ptr(this_arg);
44338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44340         this_arg_conv.is_owned = false;
44341         void* descriptor_ptr = untag_ptr(descriptor);
44342         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
44343         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
44344         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
44345         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
44346         return tag_ptr(ret_conv, true);
44347 }
44348
44349 uint64_t  __attribute__((export_name("TS_PeerManager_read_event"))) TS_PeerManager_read_event(uint64_t this_arg, uint64_t peer_descriptor, int8_tArray data) {
44350         LDKPeerManager this_arg_conv;
44351         this_arg_conv.inner = untag_ptr(this_arg);
44352         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44354         this_arg_conv.is_owned = false;
44355         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
44356         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
44357         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
44358         LDKu8slice data_ref;
44359         data_ref.datalen = data->arr_len;
44360         data_ref.data = data->elems;
44361         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
44362         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
44363         FREE(data);
44364         return tag_ptr(ret_conv, true);
44365 }
44366
44367 void  __attribute__((export_name("TS_PeerManager_process_events"))) TS_PeerManager_process_events(uint64_t this_arg) {
44368         LDKPeerManager this_arg_conv;
44369         this_arg_conv.inner = untag_ptr(this_arg);
44370         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44372         this_arg_conv.is_owned = false;
44373         PeerManager_process_events(&this_arg_conv);
44374 }
44375
44376 void  __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_PeerManager_socket_disconnected(uint64_t this_arg, uint64_t descriptor) {
44377         LDKPeerManager this_arg_conv;
44378         this_arg_conv.inner = untag_ptr(this_arg);
44379         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44381         this_arg_conv.is_owned = false;
44382         void* descriptor_ptr = untag_ptr(descriptor);
44383         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
44384         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
44385         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
44386 }
44387
44388 void  __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) {
44389         LDKPeerManager this_arg_conv;
44390         this_arg_conv.inner = untag_ptr(this_arg);
44391         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44393         this_arg_conv.is_owned = false;
44394         LDKPublicKey node_id_ref;
44395         CHECK(node_id->arr_len == 33);
44396         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
44397         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
44398 }
44399
44400 void  __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) {
44401         LDKPeerManager this_arg_conv;
44402         this_arg_conv.inner = untag_ptr(this_arg);
44403         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44405         this_arg_conv.is_owned = false;
44406         PeerManager_disconnect_all_peers(&this_arg_conv);
44407 }
44408
44409 void  __attribute__((export_name("TS_PeerManager_timer_tick_occurred"))) TS_PeerManager_timer_tick_occurred(uint64_t this_arg) {
44410         LDKPeerManager this_arg_conv;
44411         this_arg_conv.inner = untag_ptr(this_arg);
44412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44414         this_arg_conv.is_owned = false;
44415         PeerManager_timer_tick_occurred(&this_arg_conv);
44416 }
44417
44418 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) {
44419         LDKPeerManager this_arg_conv;
44420         this_arg_conv.inner = untag_ptr(this_arg);
44421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44423         this_arg_conv.is_owned = false;
44424         LDKThreeBytes rgb_ref;
44425         CHECK(rgb->arr_len == 3);
44426         memcpy(rgb_ref.data, rgb->elems, 3); FREE(rgb);
44427         LDKThirtyTwoBytes alias_ref;
44428         CHECK(alias->arr_len == 32);
44429         memcpy(alias_ref.data, alias->elems, 32); FREE(alias);
44430         LDKCVec_NetAddressZ addresses_constr;
44431         addresses_constr.datalen = addresses->arr_len;
44432         if (addresses_constr.datalen > 0)
44433                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
44434         else
44435                 addresses_constr.data = NULL;
44436         uint64_t* addresses_vals = addresses->elems;
44437         for (size_t m = 0; m < addresses_constr.datalen; m++) {
44438                 uint64_t addresses_conv_12 = addresses_vals[m];
44439                 void* addresses_conv_12_ptr = untag_ptr(addresses_conv_12);
44440                 CHECK_ACCESS(addresses_conv_12_ptr);
44441                 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
44442                 addresses_constr.data[m] = addresses_conv_12_conv;
44443         }
44444         FREE(addresses);
44445         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
44446 }
44447
44448 int64_t  __attribute__((export_name("TS_htlc_success_tx_weight"))) TS_htlc_success_tx_weight(uint64_t channel_type_features) {
44449         LDKChannelTypeFeatures channel_type_features_conv;
44450         channel_type_features_conv.inner = untag_ptr(channel_type_features);
44451         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
44452         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
44453         channel_type_features_conv.is_owned = false;
44454         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
44455         return ret_conv;
44456 }
44457
44458 int64_t  __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeout_tx_weight(uint64_t channel_type_features) {
44459         LDKChannelTypeFeatures channel_type_features_conv;
44460         channel_type_features_conv.inner = untag_ptr(channel_type_features);
44461         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
44462         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
44463         channel_type_features_conv.is_owned = false;
44464         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
44465         return ret_conv;
44466 }
44467
44468 uint32_t  __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) {
44469         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
44470         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv));
44471         return ret_conv;
44472 }
44473
44474 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() {
44475         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout());
44476         return ret_conv;
44477 }
44478
44479 uint32_t  __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() {
44480         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage());
44481         return ret_conv;
44482 }
44483
44484 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() {
44485         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout());
44486         return ret_conv;
44487 }
44488
44489 uint32_t  __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() {
44490         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage());
44491         return ret_conv;
44492 }
44493
44494 uint32_t  __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() {
44495         uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation());
44496         return ret_conv;
44497 }
44498
44499 jboolean  __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) {
44500         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
44501         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
44502         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
44503         return ret_conv;
44504 }
44505
44506 uint64_t  __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) {
44507         LDKWitness witness_ref;
44508         witness_ref.datalen = witness->arr_len;
44509         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
44510         memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness);
44511         witness_ref.data_is_owned = true;
44512         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
44513         *ret_copy = HTLCClaim_from_witness(witness_ref);
44514         uint64_t ret_ref = tag_ptr(ret_copy, true);
44515         return ret_ref;
44516 }
44517
44518 int8_tArray  __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) {
44519         uint8_t commitment_seed_arr[32];
44520         CHECK(commitment_seed->arr_len == 32);
44521         memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed);
44522         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
44523         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44524         memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32);
44525         return ret_arr;
44526 }
44527
44528 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) {
44529         LDKCVec_u8Z to_holder_script_ref;
44530         to_holder_script_ref.datalen = to_holder_script->arr_len;
44531         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
44532         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
44533         LDKCVec_u8Z to_counterparty_script_ref;
44534         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
44535         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
44536         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
44537         LDKOutPoint funding_outpoint_conv;
44538         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
44539         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
44541         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
44542         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);
44543         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44544         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44545         Transaction_free(ret_var);
44546         return ret_arr;
44547 }
44548
44549 void  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_free"))) TS_CounterpartyCommitmentSecrets_free(uint64_t this_obj) {
44550         LDKCounterpartyCommitmentSecrets this_obj_conv;
44551         this_obj_conv.inner = untag_ptr(this_obj);
44552         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44554         CounterpartyCommitmentSecrets_free(this_obj_conv);
44555 }
44556
44557 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
44558         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
44559         uint64_t ret_ref = 0;
44560         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44561         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44562         return ret_ref;
44563 }
44564 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone_ptr"))) TS_CounterpartyCommitmentSecrets_clone_ptr(uint64_t arg) {
44565         LDKCounterpartyCommitmentSecrets arg_conv;
44566         arg_conv.inner = untag_ptr(arg);
44567         arg_conv.is_owned = ptr_is_owned(arg);
44568         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44569         arg_conv.is_owned = false;
44570         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
44571         return ret_conv;
44572 }
44573
44574 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_clone"))) TS_CounterpartyCommitmentSecrets_clone(uint64_t orig) {
44575         LDKCounterpartyCommitmentSecrets orig_conv;
44576         orig_conv.inner = untag_ptr(orig);
44577         orig_conv.is_owned = ptr_is_owned(orig);
44578         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44579         orig_conv.is_owned = false;
44580         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
44581         uint64_t ret_ref = 0;
44582         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44583         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44584         return ret_ref;
44585 }
44586
44587 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_new"))) TS_CounterpartyCommitmentSecrets_new() {
44588         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
44589         uint64_t ret_ref = 0;
44590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44592         return ret_ref;
44593 }
44594
44595 int64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_min_seen_secret"))) TS_CounterpartyCommitmentSecrets_get_min_seen_secret(uint64_t this_arg) {
44596         LDKCounterpartyCommitmentSecrets this_arg_conv;
44597         this_arg_conv.inner = untag_ptr(this_arg);
44598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44600         this_arg_conv.is_owned = false;
44601         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
44602         return ret_conv;
44603 }
44604
44605 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_provide_secret"))) TS_CounterpartyCommitmentSecrets_provide_secret(uint64_t this_arg, int64_t idx, int8_tArray secret) {
44606         LDKCounterpartyCommitmentSecrets this_arg_conv;
44607         this_arg_conv.inner = untag_ptr(this_arg);
44608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44610         this_arg_conv.is_owned = false;
44611         LDKThirtyTwoBytes secret_ref;
44612         CHECK(secret->arr_len == 32);
44613         memcpy(secret_ref.data, secret->elems, 32); FREE(secret);
44614         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
44615         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
44616         return tag_ptr(ret_conv, true);
44617 }
44618
44619 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_get_secret"))) TS_CounterpartyCommitmentSecrets_get_secret(uint64_t this_arg, int64_t idx) {
44620         LDKCounterpartyCommitmentSecrets this_arg_conv;
44621         this_arg_conv.inner = untag_ptr(this_arg);
44622         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44624         this_arg_conv.is_owned = false;
44625         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44626         memcpy(ret_arr->elems, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data, 32);
44627         return ret_arr;
44628 }
44629
44630 int8_tArray  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_write"))) TS_CounterpartyCommitmentSecrets_write(uint64_t obj) {
44631         LDKCounterpartyCommitmentSecrets obj_conv;
44632         obj_conv.inner = untag_ptr(obj);
44633         obj_conv.is_owned = ptr_is_owned(obj);
44634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44635         obj_conv.is_owned = false;
44636         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
44637         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44638         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44639         CVec_u8Z_free(ret_var);
44640         return ret_arr;
44641 }
44642
44643 uint64_t  __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) TS_CounterpartyCommitmentSecrets_read(int8_tArray ser) {
44644         LDKu8slice ser_ref;
44645         ser_ref.datalen = ser->arr_len;
44646         ser_ref.data = ser->elems;
44647         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
44648         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
44649         FREE(ser);
44650         return tag_ptr(ret_conv, true);
44651 }
44652
44653 int8_tArray  __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
44654         LDKPublicKey per_commitment_point_ref;
44655         CHECK(per_commitment_point->arr_len == 33);
44656         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44657         uint8_t base_secret_arr[32];
44658         CHECK(base_secret->arr_len == 32);
44659         memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret);
44660         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
44661         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44662         memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32);
44663         return ret_arr;
44664 }
44665
44666 int8_tArray  __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) {
44667         LDKPublicKey per_commitment_point_ref;
44668         CHECK(per_commitment_point->arr_len == 33);
44669         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44670         LDKPublicKey base_point_ref;
44671         CHECK(base_point->arr_len == 33);
44672         memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point);
44673         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44674         memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33);
44675         return ret_arr;
44676 }
44677
44678 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) {
44679         uint8_t per_commitment_secret_arr[32];
44680         CHECK(per_commitment_secret->arr_len == 32);
44681         memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret);
44682         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
44683         uint8_t countersignatory_revocation_base_secret_arr[32];
44684         CHECK(countersignatory_revocation_base_secret->arr_len == 32);
44685         memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret);
44686         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
44687         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
44688         memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32);
44689         return ret_arr;
44690 }
44691
44692 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) {
44693         LDKPublicKey per_commitment_point_ref;
44694         CHECK(per_commitment_point->arr_len == 33);
44695         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
44696         LDKPublicKey countersignatory_revocation_base_point_ref;
44697         CHECK(countersignatory_revocation_base_point->arr_len == 33);
44698         memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point);
44699         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44700         memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33);
44701         return ret_arr;
44702 }
44703
44704 void  __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) {
44705         LDKTxCreationKeys this_obj_conv;
44706         this_obj_conv.inner = untag_ptr(this_obj);
44707         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44709         TxCreationKeys_free(this_obj_conv);
44710 }
44711
44712 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_per_commitment_point"))) TS_TxCreationKeys_get_per_commitment_point(uint64_t this_ptr) {
44713         LDKTxCreationKeys this_ptr_conv;
44714         this_ptr_conv.inner = untag_ptr(this_ptr);
44715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44717         this_ptr_conv.is_owned = false;
44718         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44719         memcpy(ret_arr->elems, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
44720         return ret_arr;
44721 }
44722
44723 void  __attribute__((export_name("TS_TxCreationKeys_set_per_commitment_point"))) TS_TxCreationKeys_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
44724         LDKTxCreationKeys this_ptr_conv;
44725         this_ptr_conv.inner = untag_ptr(this_ptr);
44726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44728         this_ptr_conv.is_owned = false;
44729         LDKPublicKey val_ref;
44730         CHECK(val->arr_len == 33);
44731         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44732         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
44733 }
44734
44735 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_revocation_key"))) TS_TxCreationKeys_get_revocation_key(uint64_t this_ptr) {
44736         LDKTxCreationKeys this_ptr_conv;
44737         this_ptr_conv.inner = untag_ptr(this_ptr);
44738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44740         this_ptr_conv.is_owned = false;
44741         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44742         memcpy(ret_arr->elems, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33);
44743         return ret_arr;
44744 }
44745
44746 void  __attribute__((export_name("TS_TxCreationKeys_set_revocation_key"))) TS_TxCreationKeys_set_revocation_key(uint64_t this_ptr, int8_tArray val) {
44747         LDKTxCreationKeys this_ptr_conv;
44748         this_ptr_conv.inner = untag_ptr(this_ptr);
44749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44751         this_ptr_conv.is_owned = false;
44752         LDKPublicKey val_ref;
44753         CHECK(val->arr_len == 33);
44754         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44755         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
44756 }
44757
44758 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_htlc_key"))) TS_TxCreationKeys_get_broadcaster_htlc_key(uint64_t this_ptr) {
44759         LDKTxCreationKeys this_ptr_conv;
44760         this_ptr_conv.inner = untag_ptr(this_ptr);
44761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44763         this_ptr_conv.is_owned = false;
44764         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44765         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33);
44766         return ret_arr;
44767 }
44768
44769 void  __attribute__((export_name("TS_TxCreationKeys_set_broadcaster_htlc_key"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint64_t this_ptr, int8_tArray val) {
44770         LDKTxCreationKeys 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         LDKPublicKey val_ref;
44776         CHECK(val->arr_len == 33);
44777         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44778         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
44779 }
44780
44781 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_countersignatory_htlc_key"))) TS_TxCreationKeys_get_countersignatory_htlc_key(uint64_t this_ptr) {
44782         LDKTxCreationKeys this_ptr_conv;
44783         this_ptr_conv.inner = untag_ptr(this_ptr);
44784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44786         this_ptr_conv.is_owned = false;
44787         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44788         memcpy(ret_arr->elems, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33);
44789         return ret_arr;
44790 }
44791
44792 void  __attribute__((export_name("TS_TxCreationKeys_set_countersignatory_htlc_key"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint64_t this_ptr, int8_tArray val) {
44793         LDKTxCreationKeys this_ptr_conv;
44794         this_ptr_conv.inner = untag_ptr(this_ptr);
44795         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44797         this_ptr_conv.is_owned = false;
44798         LDKPublicKey val_ref;
44799         CHECK(val->arr_len == 33);
44800         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44801         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
44802 }
44803
44804 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_get_broadcaster_delayed_payment_key"))) TS_TxCreationKeys_get_broadcaster_delayed_payment_key(uint64_t this_ptr) {
44805         LDKTxCreationKeys this_ptr_conv;
44806         this_ptr_conv.inner = untag_ptr(this_ptr);
44807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44809         this_ptr_conv.is_owned = false;
44810         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44811         memcpy(ret_arr->elems, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33);
44812         return ret_arr;
44813 }
44814
44815 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) {
44816         LDKTxCreationKeys this_ptr_conv;
44817         this_ptr_conv.inner = untag_ptr(this_ptr);
44818         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44819         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44820         this_ptr_conv.is_owned = false;
44821         LDKPublicKey val_ref;
44822         CHECK(val->arr_len == 33);
44823         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44824         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
44825 }
44826
44827 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) {
44828         LDKPublicKey per_commitment_point_arg_ref;
44829         CHECK(per_commitment_point_arg->arr_len == 33);
44830         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
44831         LDKPublicKey revocation_key_arg_ref;
44832         CHECK(revocation_key_arg->arr_len == 33);
44833         memcpy(revocation_key_arg_ref.compressed_form, revocation_key_arg->elems, 33); FREE(revocation_key_arg);
44834         LDKPublicKey broadcaster_htlc_key_arg_ref;
44835         CHECK(broadcaster_htlc_key_arg->arr_len == 33);
44836         memcpy(broadcaster_htlc_key_arg_ref.compressed_form, broadcaster_htlc_key_arg->elems, 33); FREE(broadcaster_htlc_key_arg);
44837         LDKPublicKey countersignatory_htlc_key_arg_ref;
44838         CHECK(countersignatory_htlc_key_arg->arr_len == 33);
44839         memcpy(countersignatory_htlc_key_arg_ref.compressed_form, countersignatory_htlc_key_arg->elems, 33); FREE(countersignatory_htlc_key_arg);
44840         LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
44841         CHECK(broadcaster_delayed_payment_key_arg->arr_len == 33);
44842         memcpy(broadcaster_delayed_payment_key_arg_ref.compressed_form, broadcaster_delayed_payment_key_arg->elems, 33); FREE(broadcaster_delayed_payment_key_arg);
44843         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);
44844         uint64_t ret_ref = 0;
44845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44847         return ret_ref;
44848 }
44849
44850 jboolean  __attribute__((export_name("TS_TxCreationKeys_eq"))) TS_TxCreationKeys_eq(uint64_t a, uint64_t b) {
44851         LDKTxCreationKeys a_conv;
44852         a_conv.inner = untag_ptr(a);
44853         a_conv.is_owned = ptr_is_owned(a);
44854         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44855         a_conv.is_owned = false;
44856         LDKTxCreationKeys b_conv;
44857         b_conv.inner = untag_ptr(b);
44858         b_conv.is_owned = ptr_is_owned(b);
44859         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44860         b_conv.is_owned = false;
44861         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
44862         return ret_conv;
44863 }
44864
44865 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
44866         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
44867         uint64_t ret_ref = 0;
44868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44870         return ret_ref;
44871 }
44872 int64_t  __attribute__((export_name("TS_TxCreationKeys_clone_ptr"))) TS_TxCreationKeys_clone_ptr(uint64_t arg) {
44873         LDKTxCreationKeys arg_conv;
44874         arg_conv.inner = untag_ptr(arg);
44875         arg_conv.is_owned = ptr_is_owned(arg);
44876         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44877         arg_conv.is_owned = false;
44878         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
44879         return ret_conv;
44880 }
44881
44882 uint64_t  __attribute__((export_name("TS_TxCreationKeys_clone"))) TS_TxCreationKeys_clone(uint64_t orig) {
44883         LDKTxCreationKeys orig_conv;
44884         orig_conv.inner = untag_ptr(orig);
44885         orig_conv.is_owned = ptr_is_owned(orig);
44886         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44887         orig_conv.is_owned = false;
44888         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
44889         uint64_t ret_ref = 0;
44890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44892         return ret_ref;
44893 }
44894
44895 int8_tArray  __attribute__((export_name("TS_TxCreationKeys_write"))) TS_TxCreationKeys_write(uint64_t obj) {
44896         LDKTxCreationKeys obj_conv;
44897         obj_conv.inner = untag_ptr(obj);
44898         obj_conv.is_owned = ptr_is_owned(obj);
44899         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44900         obj_conv.is_owned = false;
44901         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
44902         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
44903         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
44904         CVec_u8Z_free(ret_var);
44905         return ret_arr;
44906 }
44907
44908 uint64_t  __attribute__((export_name("TS_TxCreationKeys_read"))) TS_TxCreationKeys_read(int8_tArray ser) {
44909         LDKu8slice ser_ref;
44910         ser_ref.datalen = ser->arr_len;
44911         ser_ref.data = ser->elems;
44912         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
44913         *ret_conv = TxCreationKeys_read(ser_ref);
44914         FREE(ser);
44915         return tag_ptr(ret_conv, true);
44916 }
44917
44918 void  __attribute__((export_name("TS_ChannelPublicKeys_free"))) TS_ChannelPublicKeys_free(uint64_t this_obj) {
44919         LDKChannelPublicKeys this_obj_conv;
44920         this_obj_conv.inner = untag_ptr(this_obj);
44921         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44923         ChannelPublicKeys_free(this_obj_conv);
44924 }
44925
44926 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_funding_pubkey"))) TS_ChannelPublicKeys_get_funding_pubkey(uint64_t this_ptr) {
44927         LDKChannelPublicKeys this_ptr_conv;
44928         this_ptr_conv.inner = untag_ptr(this_ptr);
44929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44931         this_ptr_conv.is_owned = false;
44932         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44933         memcpy(ret_arr->elems, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
44934         return ret_arr;
44935 }
44936
44937 void  __attribute__((export_name("TS_ChannelPublicKeys_set_funding_pubkey"))) TS_ChannelPublicKeys_set_funding_pubkey(uint64_t this_ptr, int8_tArray val) {
44938         LDKChannelPublicKeys this_ptr_conv;
44939         this_ptr_conv.inner = untag_ptr(this_ptr);
44940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44942         this_ptr_conv.is_owned = false;
44943         LDKPublicKey val_ref;
44944         CHECK(val->arr_len == 33);
44945         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44946         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
44947 }
44948
44949 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_revocation_basepoint"))) TS_ChannelPublicKeys_get_revocation_basepoint(uint64_t this_ptr) {
44950         LDKChannelPublicKeys this_ptr_conv;
44951         this_ptr_conv.inner = untag_ptr(this_ptr);
44952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44954         this_ptr_conv.is_owned = false;
44955         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44956         memcpy(ret_arr->elems, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
44957         return ret_arr;
44958 }
44959
44960 void  __attribute__((export_name("TS_ChannelPublicKeys_set_revocation_basepoint"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint64_t this_ptr, int8_tArray val) {
44961         LDKChannelPublicKeys this_ptr_conv;
44962         this_ptr_conv.inner = untag_ptr(this_ptr);
44963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44965         this_ptr_conv.is_owned = false;
44966         LDKPublicKey val_ref;
44967         CHECK(val->arr_len == 33);
44968         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44969         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
44970 }
44971
44972 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_payment_point"))) TS_ChannelPublicKeys_get_payment_point(uint64_t this_ptr) {
44973         LDKChannelPublicKeys this_ptr_conv;
44974         this_ptr_conv.inner = untag_ptr(this_ptr);
44975         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44976         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44977         this_ptr_conv.is_owned = false;
44978         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
44979         memcpy(ret_arr->elems, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33);
44980         return ret_arr;
44981 }
44982
44983 void  __attribute__((export_name("TS_ChannelPublicKeys_set_payment_point"))) TS_ChannelPublicKeys_set_payment_point(uint64_t this_ptr, int8_tArray val) {
44984         LDKChannelPublicKeys this_ptr_conv;
44985         this_ptr_conv.inner = untag_ptr(this_ptr);
44986         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44988         this_ptr_conv.is_owned = false;
44989         LDKPublicKey val_ref;
44990         CHECK(val->arr_len == 33);
44991         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
44992         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
44993 }
44994
44995 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_delayed_payment_basepoint"))) TS_ChannelPublicKeys_get_delayed_payment_basepoint(uint64_t this_ptr) {
44996         LDKChannelPublicKeys this_ptr_conv;
44997         this_ptr_conv.inner = untag_ptr(this_ptr);
44998         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45000         this_ptr_conv.is_owned = false;
45001         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45002         memcpy(ret_arr->elems, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33);
45003         return ret_arr;
45004 }
45005
45006 void  __attribute__((export_name("TS_ChannelPublicKeys_set_delayed_payment_basepoint"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint64_t this_ptr, int8_tArray val) {
45007         LDKChannelPublicKeys this_ptr_conv;
45008         this_ptr_conv.inner = untag_ptr(this_ptr);
45009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45011         this_ptr_conv.is_owned = false;
45012         LDKPublicKey val_ref;
45013         CHECK(val->arr_len == 33);
45014         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45015         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
45016 }
45017
45018 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_get_htlc_basepoint"))) TS_ChannelPublicKeys_get_htlc_basepoint(uint64_t this_ptr) {
45019         LDKChannelPublicKeys this_ptr_conv;
45020         this_ptr_conv.inner = untag_ptr(this_ptr);
45021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45023         this_ptr_conv.is_owned = false;
45024         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
45025         memcpy(ret_arr->elems, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33);
45026         return ret_arr;
45027 }
45028
45029 void  __attribute__((export_name("TS_ChannelPublicKeys_set_htlc_basepoint"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint64_t this_ptr, int8_tArray val) {
45030         LDKChannelPublicKeys this_ptr_conv;
45031         this_ptr_conv.inner = untag_ptr(this_ptr);
45032         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45034         this_ptr_conv.is_owned = false;
45035         LDKPublicKey val_ref;
45036         CHECK(val->arr_len == 33);
45037         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
45038         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
45039 }
45040
45041 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) {
45042         LDKPublicKey funding_pubkey_arg_ref;
45043         CHECK(funding_pubkey_arg->arr_len == 33);
45044         memcpy(funding_pubkey_arg_ref.compressed_form, funding_pubkey_arg->elems, 33); FREE(funding_pubkey_arg);
45045         LDKPublicKey revocation_basepoint_arg_ref;
45046         CHECK(revocation_basepoint_arg->arr_len == 33);
45047         memcpy(revocation_basepoint_arg_ref.compressed_form, revocation_basepoint_arg->elems, 33); FREE(revocation_basepoint_arg);
45048         LDKPublicKey payment_point_arg_ref;
45049         CHECK(payment_point_arg->arr_len == 33);
45050         memcpy(payment_point_arg_ref.compressed_form, payment_point_arg->elems, 33); FREE(payment_point_arg);
45051         LDKPublicKey delayed_payment_basepoint_arg_ref;
45052         CHECK(delayed_payment_basepoint_arg->arr_len == 33);
45053         memcpy(delayed_payment_basepoint_arg_ref.compressed_form, delayed_payment_basepoint_arg->elems, 33); FREE(delayed_payment_basepoint_arg);
45054         LDKPublicKey htlc_basepoint_arg_ref;
45055         CHECK(htlc_basepoint_arg->arr_len == 33);
45056         memcpy(htlc_basepoint_arg_ref.compressed_form, htlc_basepoint_arg->elems, 33); FREE(htlc_basepoint_arg);
45057         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);
45058         uint64_t ret_ref = 0;
45059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45060         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45061         return ret_ref;
45062 }
45063
45064 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
45065         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
45066         uint64_t ret_ref = 0;
45067         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45068         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45069         return ret_ref;
45070 }
45071 int64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone_ptr"))) TS_ChannelPublicKeys_clone_ptr(uint64_t arg) {
45072         LDKChannelPublicKeys arg_conv;
45073         arg_conv.inner = untag_ptr(arg);
45074         arg_conv.is_owned = ptr_is_owned(arg);
45075         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45076         arg_conv.is_owned = false;
45077         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
45078         return ret_conv;
45079 }
45080
45081 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_clone"))) TS_ChannelPublicKeys_clone(uint64_t orig) {
45082         LDKChannelPublicKeys orig_conv;
45083         orig_conv.inner = untag_ptr(orig);
45084         orig_conv.is_owned = ptr_is_owned(orig);
45085         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45086         orig_conv.is_owned = false;
45087         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
45088         uint64_t ret_ref = 0;
45089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45091         return ret_ref;
45092 }
45093
45094 jboolean  __attribute__((export_name("TS_ChannelPublicKeys_eq"))) TS_ChannelPublicKeys_eq(uint64_t a, uint64_t b) {
45095         LDKChannelPublicKeys a_conv;
45096         a_conv.inner = untag_ptr(a);
45097         a_conv.is_owned = ptr_is_owned(a);
45098         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45099         a_conv.is_owned = false;
45100         LDKChannelPublicKeys b_conv;
45101         b_conv.inner = untag_ptr(b);
45102         b_conv.is_owned = ptr_is_owned(b);
45103         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45104         b_conv.is_owned = false;
45105         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
45106         return ret_conv;
45107 }
45108
45109 int8_tArray  __attribute__((export_name("TS_ChannelPublicKeys_write"))) TS_ChannelPublicKeys_write(uint64_t obj) {
45110         LDKChannelPublicKeys obj_conv;
45111         obj_conv.inner = untag_ptr(obj);
45112         obj_conv.is_owned = ptr_is_owned(obj);
45113         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45114         obj_conv.is_owned = false;
45115         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
45116         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45117         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45118         CVec_u8Z_free(ret_var);
45119         return ret_arr;
45120 }
45121
45122 uint64_t  __attribute__((export_name("TS_ChannelPublicKeys_read"))) TS_ChannelPublicKeys_read(int8_tArray ser) {
45123         LDKu8slice ser_ref;
45124         ser_ref.datalen = ser->arr_len;
45125         ser_ref.data = ser->elems;
45126         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
45127         *ret_conv = ChannelPublicKeys_read(ser_ref);
45128         FREE(ser);
45129         return tag_ptr(ret_conv, true);
45130 }
45131
45132 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) {
45133         LDKPublicKey per_commitment_point_ref;
45134         CHECK(per_commitment_point->arr_len == 33);
45135         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
45136         LDKPublicKey broadcaster_delayed_payment_base_ref;
45137         CHECK(broadcaster_delayed_payment_base->arr_len == 33);
45138         memcpy(broadcaster_delayed_payment_base_ref.compressed_form, broadcaster_delayed_payment_base->elems, 33); FREE(broadcaster_delayed_payment_base);
45139         LDKPublicKey broadcaster_htlc_base_ref;
45140         CHECK(broadcaster_htlc_base->arr_len == 33);
45141         memcpy(broadcaster_htlc_base_ref.compressed_form, broadcaster_htlc_base->elems, 33); FREE(broadcaster_htlc_base);
45142         LDKPublicKey countersignatory_revocation_base_ref;
45143         CHECK(countersignatory_revocation_base->arr_len == 33);
45144         memcpy(countersignatory_revocation_base_ref.compressed_form, countersignatory_revocation_base->elems, 33); FREE(countersignatory_revocation_base);
45145         LDKPublicKey countersignatory_htlc_base_ref;
45146         CHECK(countersignatory_htlc_base->arr_len == 33);
45147         memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base);
45148         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);
45149         uint64_t ret_ref = 0;
45150         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45151         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45152         return ret_ref;
45153 }
45154
45155 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) {
45156         LDKPublicKey per_commitment_point_ref;
45157         CHECK(per_commitment_point->arr_len == 33);
45158         memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point);
45159         LDKChannelPublicKeys broadcaster_keys_conv;
45160         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
45161         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
45162         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
45163         broadcaster_keys_conv.is_owned = false;
45164         LDKChannelPublicKeys countersignatory_keys_conv;
45165         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
45166         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
45167         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
45168         countersignatory_keys_conv.is_owned = false;
45169         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
45170         uint64_t ret_ref = 0;
45171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45173         return ret_ref;
45174 }
45175
45176 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) {
45177         LDKPublicKey revocation_key_ref;
45178         CHECK(revocation_key->arr_len == 33);
45179         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
45180         LDKPublicKey broadcaster_delayed_payment_key_ref;
45181         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
45182         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
45183         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
45184         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45185         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45186         CVec_u8Z_free(ret_var);
45187         return ret_arr;
45188 }
45189
45190 void  __attribute__((export_name("TS_HTLCOutputInCommitment_free"))) TS_HTLCOutputInCommitment_free(uint64_t this_obj) {
45191         LDKHTLCOutputInCommitment this_obj_conv;
45192         this_obj_conv.inner = untag_ptr(this_obj);
45193         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45195         HTLCOutputInCommitment_free(this_obj_conv);
45196 }
45197
45198 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_get_offered"))) TS_HTLCOutputInCommitment_get_offered(uint64_t this_ptr) {
45199         LDKHTLCOutputInCommitment this_ptr_conv;
45200         this_ptr_conv.inner = untag_ptr(this_ptr);
45201         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45203         this_ptr_conv.is_owned = false;
45204         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
45205         return ret_conv;
45206 }
45207
45208 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_offered"))) TS_HTLCOutputInCommitment_set_offered(uint64_t this_ptr, jboolean val) {
45209         LDKHTLCOutputInCommitment this_ptr_conv;
45210         this_ptr_conv.inner = untag_ptr(this_ptr);
45211         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45213         this_ptr_conv.is_owned = false;
45214         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
45215 }
45216
45217 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_amount_msat"))) TS_HTLCOutputInCommitment_get_amount_msat(uint64_t this_ptr) {
45218         LDKHTLCOutputInCommitment this_ptr_conv;
45219         this_ptr_conv.inner = untag_ptr(this_ptr);
45220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45222         this_ptr_conv.is_owned = false;
45223         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
45224         return ret_conv;
45225 }
45226
45227 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_amount_msat"))) TS_HTLCOutputInCommitment_set_amount_msat(uint64_t this_ptr, int64_t val) {
45228         LDKHTLCOutputInCommitment this_ptr_conv;
45229         this_ptr_conv.inner = untag_ptr(this_ptr);
45230         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45232         this_ptr_conv.is_owned = false;
45233         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
45234 }
45235
45236 int32_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_cltv_expiry"))) TS_HTLCOutputInCommitment_get_cltv_expiry(uint64_t this_ptr) {
45237         LDKHTLCOutputInCommitment this_ptr_conv;
45238         this_ptr_conv.inner = untag_ptr(this_ptr);
45239         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45241         this_ptr_conv.is_owned = false;
45242         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
45243         return ret_conv;
45244 }
45245
45246 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_cltv_expiry"))) TS_HTLCOutputInCommitment_set_cltv_expiry(uint64_t this_ptr, int32_t val) {
45247         LDKHTLCOutputInCommitment this_ptr_conv;
45248         this_ptr_conv.inner = untag_ptr(this_ptr);
45249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45251         this_ptr_conv.is_owned = false;
45252         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
45253 }
45254
45255 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_get_payment_hash"))) TS_HTLCOutputInCommitment_get_payment_hash(uint64_t this_ptr) {
45256         LDKHTLCOutputInCommitment this_ptr_conv;
45257         this_ptr_conv.inner = untag_ptr(this_ptr);
45258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45260         this_ptr_conv.is_owned = false;
45261         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
45262         memcpy(ret_arr->elems, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv), 32);
45263         return ret_arr;
45264 }
45265
45266 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_payment_hash"))) TS_HTLCOutputInCommitment_set_payment_hash(uint64_t this_ptr, int8_tArray val) {
45267         LDKHTLCOutputInCommitment this_ptr_conv;
45268         this_ptr_conv.inner = untag_ptr(this_ptr);
45269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45271         this_ptr_conv.is_owned = false;
45272         LDKThirtyTwoBytes val_ref;
45273         CHECK(val->arr_len == 32);
45274         memcpy(val_ref.data, val->elems, 32); FREE(val);
45275         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
45276 }
45277
45278 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_get_transaction_output_index"))) TS_HTLCOutputInCommitment_get_transaction_output_index(uint64_t this_ptr) {
45279         LDKHTLCOutputInCommitment this_ptr_conv;
45280         this_ptr_conv.inner = untag_ptr(this_ptr);
45281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45283         this_ptr_conv.is_owned = false;
45284         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
45285         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
45286         uint64_t ret_ref = tag_ptr(ret_copy, true);
45287         return ret_ref;
45288 }
45289
45290 void  __attribute__((export_name("TS_HTLCOutputInCommitment_set_transaction_output_index"))) TS_HTLCOutputInCommitment_set_transaction_output_index(uint64_t this_ptr, uint64_t val) {
45291         LDKHTLCOutputInCommitment this_ptr_conv;
45292         this_ptr_conv.inner = untag_ptr(this_ptr);
45293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45295         this_ptr_conv.is_owned = false;
45296         void* val_ptr = untag_ptr(val);
45297         CHECK_ACCESS(val_ptr);
45298         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
45299         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
45300         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
45301 }
45302
45303 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) {
45304         LDKThirtyTwoBytes payment_hash_arg_ref;
45305         CHECK(payment_hash_arg->arr_len == 32);
45306         memcpy(payment_hash_arg_ref.data, payment_hash_arg->elems, 32); FREE(payment_hash_arg);
45307         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
45308         CHECK_ACCESS(transaction_output_index_arg_ptr);
45309         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
45310         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
45311         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
45312         uint64_t ret_ref = 0;
45313         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45314         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45315         return ret_ref;
45316 }
45317
45318 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
45319         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
45320         uint64_t ret_ref = 0;
45321         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45322         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45323         return ret_ref;
45324 }
45325 int64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone_ptr"))) TS_HTLCOutputInCommitment_clone_ptr(uint64_t arg) {
45326         LDKHTLCOutputInCommitment arg_conv;
45327         arg_conv.inner = untag_ptr(arg);
45328         arg_conv.is_owned = ptr_is_owned(arg);
45329         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45330         arg_conv.is_owned = false;
45331         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
45332         return ret_conv;
45333 }
45334
45335 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_clone"))) TS_HTLCOutputInCommitment_clone(uint64_t orig) {
45336         LDKHTLCOutputInCommitment orig_conv;
45337         orig_conv.inner = untag_ptr(orig);
45338         orig_conv.is_owned = ptr_is_owned(orig);
45339         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45340         orig_conv.is_owned = false;
45341         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
45342         uint64_t ret_ref = 0;
45343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45345         return ret_ref;
45346 }
45347
45348 jboolean  __attribute__((export_name("TS_HTLCOutputInCommitment_eq"))) TS_HTLCOutputInCommitment_eq(uint64_t a, uint64_t b) {
45349         LDKHTLCOutputInCommitment a_conv;
45350         a_conv.inner = untag_ptr(a);
45351         a_conv.is_owned = ptr_is_owned(a);
45352         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45353         a_conv.is_owned = false;
45354         LDKHTLCOutputInCommitment b_conv;
45355         b_conv.inner = untag_ptr(b);
45356         b_conv.is_owned = ptr_is_owned(b);
45357         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45358         b_conv.is_owned = false;
45359         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
45360         return ret_conv;
45361 }
45362
45363 int8_tArray  __attribute__((export_name("TS_HTLCOutputInCommitment_write"))) TS_HTLCOutputInCommitment_write(uint64_t obj) {
45364         LDKHTLCOutputInCommitment obj_conv;
45365         obj_conv.inner = untag_ptr(obj);
45366         obj_conv.is_owned = ptr_is_owned(obj);
45367         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45368         obj_conv.is_owned = false;
45369         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
45370         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45371         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45372         CVec_u8Z_free(ret_var);
45373         return ret_arr;
45374 }
45375
45376 uint64_t  __attribute__((export_name("TS_HTLCOutputInCommitment_read"))) TS_HTLCOutputInCommitment_read(int8_tArray ser) {
45377         LDKu8slice ser_ref;
45378         ser_ref.datalen = ser->arr_len;
45379         ser_ref.data = ser->elems;
45380         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
45381         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
45382         FREE(ser);
45383         return tag_ptr(ret_conv, true);
45384 }
45385
45386 int8_tArray  __attribute__((export_name("TS_get_htlc_redeemscript"))) TS_get_htlc_redeemscript(uint64_t htlc, uint64_t channel_type_features, uint64_t keys) {
45387         LDKHTLCOutputInCommitment htlc_conv;
45388         htlc_conv.inner = untag_ptr(htlc);
45389         htlc_conv.is_owned = ptr_is_owned(htlc);
45390         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
45391         htlc_conv.is_owned = false;
45392         LDKChannelTypeFeatures channel_type_features_conv;
45393         channel_type_features_conv.inner = untag_ptr(channel_type_features);
45394         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
45395         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
45396         channel_type_features_conv.is_owned = false;
45397         LDKTxCreationKeys keys_conv;
45398         keys_conv.inner = untag_ptr(keys);
45399         keys_conv.is_owned = ptr_is_owned(keys);
45400         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
45401         keys_conv.is_owned = false;
45402         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
45403         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45404         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45405         CVec_u8Z_free(ret_var);
45406         return ret_arr;
45407 }
45408
45409 int8_tArray  __attribute__((export_name("TS_make_funding_redeemscript"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) {
45410         LDKPublicKey broadcaster_ref;
45411         CHECK(broadcaster->arr_len == 33);
45412         memcpy(broadcaster_ref.compressed_form, broadcaster->elems, 33); FREE(broadcaster);
45413         LDKPublicKey countersignatory_ref;
45414         CHECK(countersignatory->arr_len == 33);
45415         memcpy(countersignatory_ref.compressed_form, countersignatory->elems, 33); FREE(countersignatory);
45416         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
45417         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45418         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45419         CVec_u8Z_free(ret_var);
45420         return ret_arr;
45421 }
45422
45423 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) {
45424         uint8_t commitment_txid_arr[32];
45425         CHECK(commitment_txid->arr_len == 32);
45426         memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid);
45427         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
45428         LDKHTLCOutputInCommitment htlc_conv;
45429         htlc_conv.inner = untag_ptr(htlc);
45430         htlc_conv.is_owned = ptr_is_owned(htlc);
45431         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
45432         htlc_conv.is_owned = false;
45433         LDKChannelTypeFeatures channel_type_features_conv;
45434         channel_type_features_conv.inner = untag_ptr(channel_type_features);
45435         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
45436         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
45437         channel_type_features_conv.is_owned = false;
45438         LDKPublicKey broadcaster_delayed_payment_key_ref;
45439         CHECK(broadcaster_delayed_payment_key->arr_len == 33);
45440         memcpy(broadcaster_delayed_payment_key_ref.compressed_form, broadcaster_delayed_payment_key->elems, 33); FREE(broadcaster_delayed_payment_key);
45441         LDKPublicKey revocation_key_ref;
45442         CHECK(revocation_key->arr_len == 33);
45443         memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key);
45444         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);
45445         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45446         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45447         Transaction_free(ret_var);
45448         return ret_arr;
45449 }
45450
45451 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) {
45452         LDKSignature local_sig_ref;
45453         CHECK(local_sig->arr_len == 64);
45454         memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig);
45455         LDKSignature remote_sig_ref;
45456         CHECK(remote_sig->arr_len == 64);
45457         memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig);
45458         void* preimage_ptr = untag_ptr(preimage);
45459         CHECK_ACCESS(preimage_ptr);
45460         LDKCOption_PaymentPreimageZ preimage_conv = *(LDKCOption_PaymentPreimageZ*)(preimage_ptr);
45461         preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(preimage));
45462         LDKu8slice redeem_script_ref;
45463         redeem_script_ref.datalen = redeem_script->arr_len;
45464         redeem_script_ref.data = redeem_script->elems;
45465         LDKChannelTypeFeatures channel_type_features_conv;
45466         channel_type_features_conv.inner = untag_ptr(channel_type_features);
45467         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
45468         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
45469         channel_type_features_conv.is_owned = false;
45470         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_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         Witness_free(ret_var);
45474         FREE(redeem_script);
45475         return ret_arr;
45476 }
45477
45478 int8_tArray  __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) {
45479         LDKPublicKey payment_point_ref;
45480         CHECK(payment_point->arr_len == 33);
45481         memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point);
45482         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
45483         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45484         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45485         CVec_u8Z_free(ret_var);
45486         return ret_arr;
45487 }
45488
45489 int8_tArray  __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) {
45490         LDKPublicKey funding_pubkey_ref;
45491         CHECK(funding_pubkey->arr_len == 33);
45492         memcpy(funding_pubkey_ref.compressed_form, funding_pubkey->elems, 33); FREE(funding_pubkey);
45493         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
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 int8_tArray  __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) {
45501         LDKPublicKey funding_key_ref;
45502         CHECK(funding_key->arr_len == 33);
45503         memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key);
45504         LDKSignature funding_sig_ref;
45505         CHECK(funding_sig->arr_len == 64);
45506         memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig);
45507         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
45508         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45509         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45510         Witness_free(ret_var);
45511         return ret_arr;
45512 }
45513
45514 void  __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) {
45515         LDKChannelTransactionParameters this_obj_conv;
45516         this_obj_conv.inner = untag_ptr(this_obj);
45517         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45519         ChannelTransactionParameters_free(this_obj_conv);
45520 }
45521
45522 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_pubkeys"))) TS_ChannelTransactionParameters_get_holder_pubkeys(uint64_t this_ptr) {
45523         LDKChannelTransactionParameters this_ptr_conv;
45524         this_ptr_conv.inner = untag_ptr(this_ptr);
45525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45527         this_ptr_conv.is_owned = false;
45528         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
45529         uint64_t ret_ref = 0;
45530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45532         return ret_ref;
45533 }
45534
45535 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_holder_pubkeys"))) TS_ChannelTransactionParameters_set_holder_pubkeys(uint64_t this_ptr, uint64_t val) {
45536         LDKChannelTransactionParameters this_ptr_conv;
45537         this_ptr_conv.inner = untag_ptr(this_ptr);
45538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45540         this_ptr_conv.is_owned = false;
45541         LDKChannelPublicKeys val_conv;
45542         val_conv.inner = untag_ptr(val);
45543         val_conv.is_owned = ptr_is_owned(val);
45544         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45545         val_conv = ChannelPublicKeys_clone(&val_conv);
45546         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
45547 }
45548
45549 int16_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_holder_selected_contest_delay"))) TS_ChannelTransactionParameters_get_holder_selected_contest_delay(uint64_t this_ptr) {
45550         LDKChannelTransactionParameters this_ptr_conv;
45551         this_ptr_conv.inner = untag_ptr(this_ptr);
45552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45554         this_ptr_conv.is_owned = false;
45555         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
45556         return ret_conv;
45557 }
45558
45559 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) {
45560         LDKChannelTransactionParameters this_ptr_conv;
45561         this_ptr_conv.inner = untag_ptr(this_ptr);
45562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45564         this_ptr_conv.is_owned = false;
45565         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
45566 }
45567
45568 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_get_is_outbound_from_holder"))) TS_ChannelTransactionParameters_get_is_outbound_from_holder(uint64_t this_ptr) {
45569         LDKChannelTransactionParameters this_ptr_conv;
45570         this_ptr_conv.inner = untag_ptr(this_ptr);
45571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45573         this_ptr_conv.is_owned = false;
45574         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
45575         return ret_conv;
45576 }
45577
45578 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_is_outbound_from_holder"))) TS_ChannelTransactionParameters_set_is_outbound_from_holder(uint64_t this_ptr, jboolean val) {
45579         LDKChannelTransactionParameters this_ptr_conv;
45580         this_ptr_conv.inner = untag_ptr(this_ptr);
45581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45583         this_ptr_conv.is_owned = false;
45584         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
45585 }
45586
45587 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_counterparty_parameters"))) TS_ChannelTransactionParameters_get_counterparty_parameters(uint64_t this_ptr) {
45588         LDKChannelTransactionParameters this_ptr_conv;
45589         this_ptr_conv.inner = untag_ptr(this_ptr);
45590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45592         this_ptr_conv.is_owned = false;
45593         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
45594         uint64_t ret_ref = 0;
45595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45597         return ret_ref;
45598 }
45599
45600 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_counterparty_parameters"))) TS_ChannelTransactionParameters_set_counterparty_parameters(uint64_t this_ptr, uint64_t val) {
45601         LDKChannelTransactionParameters this_ptr_conv;
45602         this_ptr_conv.inner = untag_ptr(this_ptr);
45603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45605         this_ptr_conv.is_owned = false;
45606         LDKCounterpartyChannelTransactionParameters val_conv;
45607         val_conv.inner = untag_ptr(val);
45608         val_conv.is_owned = ptr_is_owned(val);
45609         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45610         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
45611         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
45612 }
45613
45614 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_funding_outpoint"))) TS_ChannelTransactionParameters_get_funding_outpoint(uint64_t this_ptr) {
45615         LDKChannelTransactionParameters this_ptr_conv;
45616         this_ptr_conv.inner = untag_ptr(this_ptr);
45617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45619         this_ptr_conv.is_owned = false;
45620         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
45621         uint64_t ret_ref = 0;
45622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45624         return ret_ref;
45625 }
45626
45627 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_funding_outpoint"))) TS_ChannelTransactionParameters_set_funding_outpoint(uint64_t this_ptr, uint64_t val) {
45628         LDKChannelTransactionParameters this_ptr_conv;
45629         this_ptr_conv.inner = untag_ptr(this_ptr);
45630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45632         this_ptr_conv.is_owned = false;
45633         LDKOutPoint val_conv;
45634         val_conv.inner = untag_ptr(val);
45635         val_conv.is_owned = ptr_is_owned(val);
45636         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45637         val_conv = OutPoint_clone(&val_conv);
45638         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
45639 }
45640
45641 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_get_channel_type_features"))) TS_ChannelTransactionParameters_get_channel_type_features(uint64_t this_ptr) {
45642         LDKChannelTransactionParameters this_ptr_conv;
45643         this_ptr_conv.inner = untag_ptr(this_ptr);
45644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45646         this_ptr_conv.is_owned = false;
45647         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
45648         uint64_t ret_ref = 0;
45649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45651         return ret_ref;
45652 }
45653
45654 void  __attribute__((export_name("TS_ChannelTransactionParameters_set_channel_type_features"))) TS_ChannelTransactionParameters_set_channel_type_features(uint64_t this_ptr, uint64_t val) {
45655         LDKChannelTransactionParameters this_ptr_conv;
45656         this_ptr_conv.inner = untag_ptr(this_ptr);
45657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45659         this_ptr_conv.is_owned = false;
45660         LDKChannelTypeFeatures val_conv;
45661         val_conv.inner = untag_ptr(val);
45662         val_conv.is_owned = ptr_is_owned(val);
45663         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45664         val_conv = ChannelTypeFeatures_clone(&val_conv);
45665         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
45666 }
45667
45668 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) {
45669         LDKChannelPublicKeys holder_pubkeys_arg_conv;
45670         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
45671         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
45672         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
45673         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
45674         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
45675         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
45676         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
45677         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
45678         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
45679         LDKOutPoint funding_outpoint_arg_conv;
45680         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
45681         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
45682         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
45683         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
45684         LDKChannelTypeFeatures channel_type_features_arg_conv;
45685         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
45686         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
45687         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
45688         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
45689         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);
45690         uint64_t ret_ref = 0;
45691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45693         return ret_ref;
45694 }
45695
45696 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
45697         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
45698         uint64_t ret_ref = 0;
45699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45701         return ret_ref;
45702 }
45703 int64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone_ptr"))) TS_ChannelTransactionParameters_clone_ptr(uint64_t arg) {
45704         LDKChannelTransactionParameters arg_conv;
45705         arg_conv.inner = untag_ptr(arg);
45706         arg_conv.is_owned = ptr_is_owned(arg);
45707         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45708         arg_conv.is_owned = false;
45709         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
45710         return ret_conv;
45711 }
45712
45713 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_clone"))) TS_ChannelTransactionParameters_clone(uint64_t orig) {
45714         LDKChannelTransactionParameters orig_conv;
45715         orig_conv.inner = untag_ptr(orig);
45716         orig_conv.is_owned = ptr_is_owned(orig);
45717         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45718         orig_conv.is_owned = false;
45719         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
45720         uint64_t ret_ref = 0;
45721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45723         return ret_ref;
45724 }
45725
45726 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_eq"))) TS_ChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
45727         LDKChannelTransactionParameters a_conv;
45728         a_conv.inner = untag_ptr(a);
45729         a_conv.is_owned = ptr_is_owned(a);
45730         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45731         a_conv.is_owned = false;
45732         LDKChannelTransactionParameters b_conv;
45733         b_conv.inner = untag_ptr(b);
45734         b_conv.is_owned = ptr_is_owned(b);
45735         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45736         b_conv.is_owned = false;
45737         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
45738         return ret_conv;
45739 }
45740
45741 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_free"))) TS_CounterpartyChannelTransactionParameters_free(uint64_t this_obj) {
45742         LDKCounterpartyChannelTransactionParameters this_obj_conv;
45743         this_obj_conv.inner = untag_ptr(this_obj);
45744         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45746         CounterpartyChannelTransactionParameters_free(this_obj_conv);
45747 }
45748
45749 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_pubkeys"))) TS_CounterpartyChannelTransactionParameters_get_pubkeys(uint64_t this_ptr) {
45750         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
45751         this_ptr_conv.inner = untag_ptr(this_ptr);
45752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45754         this_ptr_conv.is_owned = false;
45755         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
45756         uint64_t ret_ref = 0;
45757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45759         return ret_ref;
45760 }
45761
45762 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_pubkeys"))) TS_CounterpartyChannelTransactionParameters_set_pubkeys(uint64_t this_ptr, uint64_t val) {
45763         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
45764         this_ptr_conv.inner = untag_ptr(this_ptr);
45765         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45766         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45767         this_ptr_conv.is_owned = false;
45768         LDKChannelPublicKeys val_conv;
45769         val_conv.inner = untag_ptr(val);
45770         val_conv.is_owned = ptr_is_owned(val);
45771         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
45772         val_conv = ChannelPublicKeys_clone(&val_conv);
45773         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
45774 }
45775
45776 int16_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_get_selected_contest_delay(uint64_t this_ptr) {
45777         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
45778         this_ptr_conv.inner = untag_ptr(this_ptr);
45779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45781         this_ptr_conv.is_owned = false;
45782         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
45783         return ret_conv;
45784 }
45785
45786 void  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay"))) TS_CounterpartyChannelTransactionParameters_set_selected_contest_delay(uint64_t this_ptr, int16_t val) {
45787         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
45788         this_ptr_conv.inner = untag_ptr(this_ptr);
45789         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45791         this_ptr_conv.is_owned = false;
45792         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
45793 }
45794
45795 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_new"))) TS_CounterpartyChannelTransactionParameters_new(uint64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
45796         LDKChannelPublicKeys pubkeys_arg_conv;
45797         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
45798         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
45799         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
45800         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
45801         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
45802         uint64_t ret_ref = 0;
45803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45805         return ret_ref;
45806 }
45807
45808 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
45809         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
45810         uint64_t ret_ref = 0;
45811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45813         return ret_ref;
45814 }
45815 int64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone_ptr"))) TS_CounterpartyChannelTransactionParameters_clone_ptr(uint64_t arg) {
45816         LDKCounterpartyChannelTransactionParameters arg_conv;
45817         arg_conv.inner = untag_ptr(arg);
45818         arg_conv.is_owned = ptr_is_owned(arg);
45819         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45820         arg_conv.is_owned = false;
45821         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
45822         return ret_conv;
45823 }
45824
45825 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_clone"))) TS_CounterpartyChannelTransactionParameters_clone(uint64_t orig) {
45826         LDKCounterpartyChannelTransactionParameters orig_conv;
45827         orig_conv.inner = untag_ptr(orig);
45828         orig_conv.is_owned = ptr_is_owned(orig);
45829         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45830         orig_conv.is_owned = false;
45831         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
45832         uint64_t ret_ref = 0;
45833         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45834         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45835         return ret_ref;
45836 }
45837
45838 jboolean  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_eq"))) TS_CounterpartyChannelTransactionParameters_eq(uint64_t a, uint64_t b) {
45839         LDKCounterpartyChannelTransactionParameters a_conv;
45840         a_conv.inner = untag_ptr(a);
45841         a_conv.is_owned = ptr_is_owned(a);
45842         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45843         a_conv.is_owned = false;
45844         LDKCounterpartyChannelTransactionParameters b_conv;
45845         b_conv.inner = untag_ptr(b);
45846         b_conv.is_owned = ptr_is_owned(b);
45847         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45848         b_conv.is_owned = false;
45849         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
45850         return ret_conv;
45851 }
45852
45853 jboolean  __attribute__((export_name("TS_ChannelTransactionParameters_is_populated"))) TS_ChannelTransactionParameters_is_populated(uint64_t this_arg) {
45854         LDKChannelTransactionParameters this_arg_conv;
45855         this_arg_conv.inner = untag_ptr(this_arg);
45856         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45858         this_arg_conv.is_owned = false;
45859         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
45860         return ret_conv;
45861 }
45862
45863 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_holder_broadcastable"))) TS_ChannelTransactionParameters_as_holder_broadcastable(uint64_t this_arg) {
45864         LDKChannelTransactionParameters this_arg_conv;
45865         this_arg_conv.inner = untag_ptr(this_arg);
45866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45868         this_arg_conv.is_owned = false;
45869         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
45870         uint64_t ret_ref = 0;
45871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45873         return ret_ref;
45874 }
45875
45876 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_as_counterparty_broadcastable"))) TS_ChannelTransactionParameters_as_counterparty_broadcastable(uint64_t this_arg) {
45877         LDKChannelTransactionParameters this_arg_conv;
45878         this_arg_conv.inner = untag_ptr(this_arg);
45879         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45881         this_arg_conv.is_owned = false;
45882         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
45883         uint64_t ret_ref = 0;
45884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45886         return ret_ref;
45887 }
45888
45889 int8_tArray  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_write"))) TS_CounterpartyChannelTransactionParameters_write(uint64_t obj) {
45890         LDKCounterpartyChannelTransactionParameters obj_conv;
45891         obj_conv.inner = untag_ptr(obj);
45892         obj_conv.is_owned = ptr_is_owned(obj);
45893         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45894         obj_conv.is_owned = false;
45895         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
45896         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45897         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45898         CVec_u8Z_free(ret_var);
45899         return ret_arr;
45900 }
45901
45902 uint64_t  __attribute__((export_name("TS_CounterpartyChannelTransactionParameters_read"))) TS_CounterpartyChannelTransactionParameters_read(int8_tArray ser) {
45903         LDKu8slice ser_ref;
45904         ser_ref.datalen = ser->arr_len;
45905         ser_ref.data = ser->elems;
45906         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
45907         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
45908         FREE(ser);
45909         return tag_ptr(ret_conv, true);
45910 }
45911
45912 int8_tArray  __attribute__((export_name("TS_ChannelTransactionParameters_write"))) TS_ChannelTransactionParameters_write(uint64_t obj) {
45913         LDKChannelTransactionParameters obj_conv;
45914         obj_conv.inner = untag_ptr(obj);
45915         obj_conv.is_owned = ptr_is_owned(obj);
45916         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45917         obj_conv.is_owned = false;
45918         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
45919         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
45920         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
45921         CVec_u8Z_free(ret_var);
45922         return ret_arr;
45923 }
45924
45925 uint64_t  __attribute__((export_name("TS_ChannelTransactionParameters_read"))) TS_ChannelTransactionParameters_read(int8_tArray ser) {
45926         LDKu8slice ser_ref;
45927         ser_ref.datalen = ser->arr_len;
45928         ser_ref.data = ser->elems;
45929         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
45930         *ret_conv = ChannelTransactionParameters_read(ser_ref);
45931         FREE(ser);
45932         return tag_ptr(ret_conv, true);
45933 }
45934
45935 void  __attribute__((export_name("TS_DirectedChannelTransactionParameters_free"))) TS_DirectedChannelTransactionParameters_free(uint64_t this_obj) {
45936         LDKDirectedChannelTransactionParameters this_obj_conv;
45937         this_obj_conv.inner = untag_ptr(this_obj);
45938         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45940         DirectedChannelTransactionParameters_free(this_obj_conv);
45941 }
45942
45943 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_broadcaster_pubkeys"))) TS_DirectedChannelTransactionParameters_broadcaster_pubkeys(uint64_t this_arg) {
45944         LDKDirectedChannelTransactionParameters this_arg_conv;
45945         this_arg_conv.inner = untag_ptr(this_arg);
45946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45948         this_arg_conv.is_owned = false;
45949         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
45950         uint64_t ret_ref = 0;
45951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45953         return ret_ref;
45954 }
45955
45956 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_countersignatory_pubkeys"))) TS_DirectedChannelTransactionParameters_countersignatory_pubkeys(uint64_t this_arg) {
45957         LDKDirectedChannelTransactionParameters this_arg_conv;
45958         this_arg_conv.inner = untag_ptr(this_arg);
45959         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45961         this_arg_conv.is_owned = false;
45962         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
45963         uint64_t ret_ref = 0;
45964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45966         return ret_ref;
45967 }
45968
45969 int16_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_contest_delay"))) TS_DirectedChannelTransactionParameters_contest_delay(uint64_t this_arg) {
45970         LDKDirectedChannelTransactionParameters this_arg_conv;
45971         this_arg_conv.inner = untag_ptr(this_arg);
45972         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45974         this_arg_conv.is_owned = false;
45975         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
45976         return ret_conv;
45977 }
45978
45979 jboolean  __attribute__((export_name("TS_DirectedChannelTransactionParameters_is_outbound"))) TS_DirectedChannelTransactionParameters_is_outbound(uint64_t this_arg) {
45980         LDKDirectedChannelTransactionParameters this_arg_conv;
45981         this_arg_conv.inner = untag_ptr(this_arg);
45982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45984         this_arg_conv.is_owned = false;
45985         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
45986         return ret_conv;
45987 }
45988
45989 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_funding_outpoint"))) TS_DirectedChannelTransactionParameters_funding_outpoint(uint64_t this_arg) {
45990         LDKDirectedChannelTransactionParameters this_arg_conv;
45991         this_arg_conv.inner = untag_ptr(this_arg);
45992         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45993         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45994         this_arg_conv.is_owned = false;
45995         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
45996         uint64_t ret_ref = 0;
45997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45999         return ret_ref;
46000 }
46001
46002 uint64_t  __attribute__((export_name("TS_DirectedChannelTransactionParameters_channel_type_features"))) TS_DirectedChannelTransactionParameters_channel_type_features(uint64_t this_arg) {
46003         LDKDirectedChannelTransactionParameters this_arg_conv;
46004         this_arg_conv.inner = untag_ptr(this_arg);
46005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46007         this_arg_conv.is_owned = false;
46008         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
46009         uint64_t ret_ref = 0;
46010         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46011         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46012         return ret_ref;
46013 }
46014
46015 void  __attribute__((export_name("TS_HolderCommitmentTransaction_free"))) TS_HolderCommitmentTransaction_free(uint64_t this_obj) {
46016         LDKHolderCommitmentTransaction this_obj_conv;
46017         this_obj_conv.inner = untag_ptr(this_obj);
46018         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46020         HolderCommitmentTransaction_free(this_obj_conv);
46021 }
46022
46023 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_sig"))) TS_HolderCommitmentTransaction_get_counterparty_sig(uint64_t this_ptr) {
46024         LDKHolderCommitmentTransaction this_ptr_conv;
46025         this_ptr_conv.inner = untag_ptr(this_ptr);
46026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46028         this_ptr_conv.is_owned = false;
46029         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46030         memcpy(ret_arr->elems, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
46031         return ret_arr;
46032 }
46033
46034 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_sig"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
46035         LDKHolderCommitmentTransaction this_ptr_conv;
46036         this_ptr_conv.inner = untag_ptr(this_ptr);
46037         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46039         this_ptr_conv.is_owned = false;
46040         LDKSignature val_ref;
46041         CHECK(val->arr_len == 64);
46042         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
46043         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
46044 }
46045
46046 ptrArray  __attribute__((export_name("TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_get_counterparty_htlc_sigs(uint64_t this_ptr) {
46047         LDKHolderCommitmentTransaction this_ptr_conv;
46048         this_ptr_conv.inner = untag_ptr(this_ptr);
46049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46051         this_ptr_conv.is_owned = false;
46052         LDKCVec_SignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
46053         ptrArray ret_arr = NULL;
46054         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
46055         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
46056         for (size_t m = 0; m < ret_var.datalen; m++) {
46057                 int8_tArray ret_conv_12_arr = init_int8_tArray(64, __LINE__);
46058                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compact_form, 64);
46059                 ret_arr_ptr[m] = ret_conv_12_arr;
46060         }
46061         
46062         FREE(ret_var.data);
46063         return ret_arr;
46064 }
46065
46066 void  __attribute__((export_name("TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs"))) TS_HolderCommitmentTransaction_set_counterparty_htlc_sigs(uint64_t this_ptr, ptrArray val) {
46067         LDKHolderCommitmentTransaction this_ptr_conv;
46068         this_ptr_conv.inner = untag_ptr(this_ptr);
46069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46071         this_ptr_conv.is_owned = false;
46072         LDKCVec_SignatureZ val_constr;
46073         val_constr.datalen = val->arr_len;
46074         if (val_constr.datalen > 0)
46075                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
46076         else
46077                 val_constr.data = NULL;
46078         int8_tArray* val_vals = (void*) val->elems;
46079         for (size_t m = 0; m < val_constr.datalen; m++) {
46080                 int8_tArray val_conv_12 = val_vals[m];
46081                 LDKSignature val_conv_12_ref;
46082                 CHECK(val_conv_12->arr_len == 64);
46083                 memcpy(val_conv_12_ref.compact_form, val_conv_12->elems, 64); FREE(val_conv_12);
46084                 val_constr.data[m] = val_conv_12_ref;
46085         }
46086         FREE(val);
46087         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
46088 }
46089
46090 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
46091         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
46092         uint64_t ret_ref = 0;
46093         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46094         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46095         return ret_ref;
46096 }
46097 int64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone_ptr"))) TS_HolderCommitmentTransaction_clone_ptr(uint64_t arg) {
46098         LDKHolderCommitmentTransaction arg_conv;
46099         arg_conv.inner = untag_ptr(arg);
46100         arg_conv.is_owned = ptr_is_owned(arg);
46101         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46102         arg_conv.is_owned = false;
46103         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
46104         return ret_conv;
46105 }
46106
46107 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_clone"))) TS_HolderCommitmentTransaction_clone(uint64_t orig) {
46108         LDKHolderCommitmentTransaction orig_conv;
46109         orig_conv.inner = untag_ptr(orig);
46110         orig_conv.is_owned = ptr_is_owned(orig);
46111         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46112         orig_conv.is_owned = false;
46113         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
46114         uint64_t ret_ref = 0;
46115         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46116         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46117         return ret_ref;
46118 }
46119
46120 int8_tArray  __attribute__((export_name("TS_HolderCommitmentTransaction_write"))) TS_HolderCommitmentTransaction_write(uint64_t obj) {
46121         LDKHolderCommitmentTransaction obj_conv;
46122         obj_conv.inner = untag_ptr(obj);
46123         obj_conv.is_owned = ptr_is_owned(obj);
46124         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46125         obj_conv.is_owned = false;
46126         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
46127         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46128         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46129         CVec_u8Z_free(ret_var);
46130         return ret_arr;
46131 }
46132
46133 uint64_t  __attribute__((export_name("TS_HolderCommitmentTransaction_read"))) TS_HolderCommitmentTransaction_read(int8_tArray ser) {
46134         LDKu8slice ser_ref;
46135         ser_ref.datalen = ser->arr_len;
46136         ser_ref.data = ser->elems;
46137         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
46138         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
46139         FREE(ser);
46140         return tag_ptr(ret_conv, true);
46141 }
46142
46143 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) {
46144         LDKCommitmentTransaction commitment_tx_conv;
46145         commitment_tx_conv.inner = untag_ptr(commitment_tx);
46146         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
46147         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
46148         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
46149         LDKSignature counterparty_sig_ref;
46150         CHECK(counterparty_sig->arr_len == 64);
46151         memcpy(counterparty_sig_ref.compact_form, counterparty_sig->elems, 64); FREE(counterparty_sig);
46152         LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
46153         counterparty_htlc_sigs_constr.datalen = counterparty_htlc_sigs->arr_len;
46154         if (counterparty_htlc_sigs_constr.datalen > 0)
46155                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
46156         else
46157                 counterparty_htlc_sigs_constr.data = NULL;
46158         int8_tArray* counterparty_htlc_sigs_vals = (void*) counterparty_htlc_sigs->elems;
46159         for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) {
46160                 int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m];
46161                 LDKSignature counterparty_htlc_sigs_conv_12_ref;
46162                 CHECK(counterparty_htlc_sigs_conv_12->arr_len == 64);
46163                 memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, counterparty_htlc_sigs_conv_12->elems, 64); FREE(counterparty_htlc_sigs_conv_12);
46164                 counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref;
46165         }
46166         FREE(counterparty_htlc_sigs);
46167         LDKPublicKey holder_funding_key_ref;
46168         CHECK(holder_funding_key->arr_len == 33);
46169         memcpy(holder_funding_key_ref.compressed_form, holder_funding_key->elems, 33); FREE(holder_funding_key);
46170         LDKPublicKey counterparty_funding_key_ref;
46171         CHECK(counterparty_funding_key->arr_len == 33);
46172         memcpy(counterparty_funding_key_ref.compressed_form, counterparty_funding_key->elems, 33); FREE(counterparty_funding_key);
46173         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
46174         uint64_t ret_ref = 0;
46175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46177         return ret_ref;
46178 }
46179
46180 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_free"))) TS_BuiltCommitmentTransaction_free(uint64_t this_obj) {
46181         LDKBuiltCommitmentTransaction this_obj_conv;
46182         this_obj_conv.inner = untag_ptr(this_obj);
46183         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46185         BuiltCommitmentTransaction_free(this_obj_conv);
46186 }
46187
46188 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_transaction"))) TS_BuiltCommitmentTransaction_get_transaction(uint64_t this_ptr) {
46189         LDKBuiltCommitmentTransaction this_ptr_conv;
46190         this_ptr_conv.inner = untag_ptr(this_ptr);
46191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46193         this_ptr_conv.is_owned = false;
46194         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
46195         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46196         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46197         Transaction_free(ret_var);
46198         return ret_arr;
46199 }
46200
46201 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_transaction"))) TS_BuiltCommitmentTransaction_set_transaction(uint64_t this_ptr, int8_tArray val) {
46202         LDKBuiltCommitmentTransaction this_ptr_conv;
46203         this_ptr_conv.inner = untag_ptr(this_ptr);
46204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46206         this_ptr_conv.is_owned = false;
46207         LDKTransaction val_ref;
46208         val_ref.datalen = val->arr_len;
46209         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
46210         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
46211         val_ref.data_is_owned = true;
46212         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
46213 }
46214
46215 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_get_txid"))) TS_BuiltCommitmentTransaction_get_txid(uint64_t this_ptr) {
46216         LDKBuiltCommitmentTransaction this_ptr_conv;
46217         this_ptr_conv.inner = untag_ptr(this_ptr);
46218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46220         this_ptr_conv.is_owned = false;
46221         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46222         memcpy(ret_arr->elems, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv), 32);
46223         return ret_arr;
46224 }
46225
46226 void  __attribute__((export_name("TS_BuiltCommitmentTransaction_set_txid"))) TS_BuiltCommitmentTransaction_set_txid(uint64_t this_ptr, int8_tArray val) {
46227         LDKBuiltCommitmentTransaction this_ptr_conv;
46228         this_ptr_conv.inner = untag_ptr(this_ptr);
46229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46231         this_ptr_conv.is_owned = false;
46232         LDKThirtyTwoBytes val_ref;
46233         CHECK(val->arr_len == 32);
46234         memcpy(val_ref.data, val->elems, 32); FREE(val);
46235         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
46236 }
46237
46238 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_new"))) TS_BuiltCommitmentTransaction_new(int8_tArray transaction_arg, int8_tArray txid_arg) {
46239         LDKTransaction transaction_arg_ref;
46240         transaction_arg_ref.datalen = transaction_arg->arr_len;
46241         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
46242         memcpy(transaction_arg_ref.data, transaction_arg->elems, transaction_arg_ref.datalen); FREE(transaction_arg);
46243         transaction_arg_ref.data_is_owned = true;
46244         LDKThirtyTwoBytes txid_arg_ref;
46245         CHECK(txid_arg->arr_len == 32);
46246         memcpy(txid_arg_ref.data, txid_arg->elems, 32); FREE(txid_arg);
46247         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
46248         uint64_t ret_ref = 0;
46249         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46250         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46251         return ret_ref;
46252 }
46253
46254 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
46255         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
46256         uint64_t ret_ref = 0;
46257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46259         return ret_ref;
46260 }
46261 int64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone_ptr"))) TS_BuiltCommitmentTransaction_clone_ptr(uint64_t arg) {
46262         LDKBuiltCommitmentTransaction arg_conv;
46263         arg_conv.inner = untag_ptr(arg);
46264         arg_conv.is_owned = ptr_is_owned(arg);
46265         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46266         arg_conv.is_owned = false;
46267         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
46268         return ret_conv;
46269 }
46270
46271 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_clone"))) TS_BuiltCommitmentTransaction_clone(uint64_t orig) {
46272         LDKBuiltCommitmentTransaction orig_conv;
46273         orig_conv.inner = untag_ptr(orig);
46274         orig_conv.is_owned = ptr_is_owned(orig);
46275         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46276         orig_conv.is_owned = false;
46277         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
46278         uint64_t ret_ref = 0;
46279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46281         return ret_ref;
46282 }
46283
46284 int8_tArray  __attribute__((export_name("TS_BuiltCommitmentTransaction_write"))) TS_BuiltCommitmentTransaction_write(uint64_t obj) {
46285         LDKBuiltCommitmentTransaction obj_conv;
46286         obj_conv.inner = untag_ptr(obj);
46287         obj_conv.is_owned = ptr_is_owned(obj);
46288         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46289         obj_conv.is_owned = false;
46290         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
46291         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46292         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46293         CVec_u8Z_free(ret_var);
46294         return ret_arr;
46295 }
46296
46297 uint64_t  __attribute__((export_name("TS_BuiltCommitmentTransaction_read"))) TS_BuiltCommitmentTransaction_read(int8_tArray ser) {
46298         LDKu8slice ser_ref;
46299         ser_ref.datalen = ser->arr_len;
46300         ser_ref.data = ser->elems;
46301         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
46302         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
46303         FREE(ser);
46304         return tag_ptr(ret_conv, true);
46305 }
46306
46307 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) {
46308         LDKBuiltCommitmentTransaction this_arg_conv;
46309         this_arg_conv.inner = untag_ptr(this_arg);
46310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46312         this_arg_conv.is_owned = false;
46313         LDKu8slice funding_redeemscript_ref;
46314         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46315         funding_redeemscript_ref.data = funding_redeemscript->elems;
46316         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46317         memcpy(ret_arr->elems, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
46318         FREE(funding_redeemscript);
46319         return ret_arr;
46320 }
46321
46322 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) {
46323         LDKBuiltCommitmentTransaction this_arg_conv;
46324         this_arg_conv.inner = untag_ptr(this_arg);
46325         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46327         this_arg_conv.is_owned = false;
46328         uint8_t funding_key_arr[32];
46329         CHECK(funding_key->arr_len == 32);
46330         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
46331         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
46332         LDKu8slice funding_redeemscript_ref;
46333         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46334         funding_redeemscript_ref.data = funding_redeemscript->elems;
46335         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46336         memcpy(ret_arr->elems, BuiltCommitmentTransaction_sign_counterparty_commitment(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
46337         FREE(funding_redeemscript);
46338         return ret_arr;
46339 }
46340
46341 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) {
46342         LDKBuiltCommitmentTransaction this_arg_conv;
46343         this_arg_conv.inner = untag_ptr(this_arg);
46344         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46345         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46346         this_arg_conv.is_owned = false;
46347         uint8_t funding_key_arr[32];
46348         CHECK(funding_key->arr_len == 32);
46349         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
46350         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
46351         LDKu8slice funding_redeemscript_ref;
46352         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46353         funding_redeemscript_ref.data = funding_redeemscript->elems;
46354         void* entropy_source_ptr = untag_ptr(entropy_source);
46355         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
46356         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
46357         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46358         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);
46359         FREE(funding_redeemscript);
46360         return ret_arr;
46361 }
46362
46363 void  __attribute__((export_name("TS_ClosingTransaction_free"))) TS_ClosingTransaction_free(uint64_t this_obj) {
46364         LDKClosingTransaction this_obj_conv;
46365         this_obj_conv.inner = untag_ptr(this_obj);
46366         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46368         ClosingTransaction_free(this_obj_conv);
46369 }
46370
46371 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
46372         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
46373         uint64_t ret_ref = 0;
46374         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46375         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46376         return ret_ref;
46377 }
46378 int64_t  __attribute__((export_name("TS_ClosingTransaction_clone_ptr"))) TS_ClosingTransaction_clone_ptr(uint64_t arg) {
46379         LDKClosingTransaction arg_conv;
46380         arg_conv.inner = untag_ptr(arg);
46381         arg_conv.is_owned = ptr_is_owned(arg);
46382         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46383         arg_conv.is_owned = false;
46384         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
46385         return ret_conv;
46386 }
46387
46388 uint64_t  __attribute__((export_name("TS_ClosingTransaction_clone"))) TS_ClosingTransaction_clone(uint64_t orig) {
46389         LDKClosingTransaction orig_conv;
46390         orig_conv.inner = untag_ptr(orig);
46391         orig_conv.is_owned = ptr_is_owned(orig);
46392         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46393         orig_conv.is_owned = false;
46394         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
46395         uint64_t ret_ref = 0;
46396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46398         return ret_ref;
46399 }
46400
46401 int64_t  __attribute__((export_name("TS_ClosingTransaction_hash"))) TS_ClosingTransaction_hash(uint64_t o) {
46402         LDKClosingTransaction o_conv;
46403         o_conv.inner = untag_ptr(o);
46404         o_conv.is_owned = ptr_is_owned(o);
46405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46406         o_conv.is_owned = false;
46407         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
46408         return ret_conv;
46409 }
46410
46411 jboolean  __attribute__((export_name("TS_ClosingTransaction_eq"))) TS_ClosingTransaction_eq(uint64_t a, uint64_t b) {
46412         LDKClosingTransaction a_conv;
46413         a_conv.inner = untag_ptr(a);
46414         a_conv.is_owned = ptr_is_owned(a);
46415         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46416         a_conv.is_owned = false;
46417         LDKClosingTransaction b_conv;
46418         b_conv.inner = untag_ptr(b);
46419         b_conv.is_owned = ptr_is_owned(b);
46420         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46421         b_conv.is_owned = false;
46422         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
46423         return ret_conv;
46424 }
46425
46426 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) {
46427         LDKCVec_u8Z to_holder_script_ref;
46428         to_holder_script_ref.datalen = to_holder_script->arr_len;
46429         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
46430         memcpy(to_holder_script_ref.data, to_holder_script->elems, to_holder_script_ref.datalen); FREE(to_holder_script);
46431         LDKCVec_u8Z to_counterparty_script_ref;
46432         to_counterparty_script_ref.datalen = to_counterparty_script->arr_len;
46433         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
46434         memcpy(to_counterparty_script_ref.data, to_counterparty_script->elems, to_counterparty_script_ref.datalen); FREE(to_counterparty_script);
46435         LDKOutPoint funding_outpoint_conv;
46436         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
46437         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
46438         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
46439         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
46440         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
46441         uint64_t ret_ref = 0;
46442         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46443         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46444         return ret_ref;
46445 }
46446
46447 uint64_t  __attribute__((export_name("TS_ClosingTransaction_trust"))) TS_ClosingTransaction_trust(uint64_t this_arg) {
46448         LDKClosingTransaction this_arg_conv;
46449         this_arg_conv.inner = untag_ptr(this_arg);
46450         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46452         this_arg_conv.is_owned = false;
46453         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
46454         uint64_t ret_ref = 0;
46455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46457         return ret_ref;
46458 }
46459
46460 uint64_t  __attribute__((export_name("TS_ClosingTransaction_verify"))) TS_ClosingTransaction_verify(uint64_t this_arg, uint64_t funding_outpoint) {
46461         LDKClosingTransaction this_arg_conv;
46462         this_arg_conv.inner = untag_ptr(this_arg);
46463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46465         this_arg_conv.is_owned = false;
46466         LDKOutPoint funding_outpoint_conv;
46467         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
46468         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
46469         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
46470         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
46471         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
46472         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
46473         return tag_ptr(ret_conv, true);
46474 }
46475
46476 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_holder_value_sat"))) TS_ClosingTransaction_to_holder_value_sat(uint64_t this_arg) {
46477         LDKClosingTransaction this_arg_conv;
46478         this_arg_conv.inner = untag_ptr(this_arg);
46479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46481         this_arg_conv.is_owned = false;
46482         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
46483         return ret_conv;
46484 }
46485
46486 int64_t  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_value_sat"))) TS_ClosingTransaction_to_counterparty_value_sat(uint64_t this_arg) {
46487         LDKClosingTransaction this_arg_conv;
46488         this_arg_conv.inner = untag_ptr(this_arg);
46489         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46491         this_arg_conv.is_owned = false;
46492         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
46493         return ret_conv;
46494 }
46495
46496 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_holder_script"))) TS_ClosingTransaction_to_holder_script(uint64_t this_arg) {
46497         LDKClosingTransaction this_arg_conv;
46498         this_arg_conv.inner = untag_ptr(this_arg);
46499         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46501         this_arg_conv.is_owned = false;
46502         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
46503         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46504         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46505         return ret_arr;
46506 }
46507
46508 int8_tArray  __attribute__((export_name("TS_ClosingTransaction_to_counterparty_script"))) TS_ClosingTransaction_to_counterparty_script(uint64_t this_arg) {
46509         LDKClosingTransaction this_arg_conv;
46510         this_arg_conv.inner = untag_ptr(this_arg);
46511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46513         this_arg_conv.is_owned = false;
46514         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
46515         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46516         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46517         return ret_arr;
46518 }
46519
46520 void  __attribute__((export_name("TS_TrustedClosingTransaction_free"))) TS_TrustedClosingTransaction_free(uint64_t this_obj) {
46521         LDKTrustedClosingTransaction this_obj_conv;
46522         this_obj_conv.inner = untag_ptr(this_obj);
46523         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46525         TrustedClosingTransaction_free(this_obj_conv);
46526 }
46527
46528 int8_tArray  __attribute__((export_name("TS_TrustedClosingTransaction_built_transaction"))) TS_TrustedClosingTransaction_built_transaction(uint64_t this_arg) {
46529         LDKTrustedClosingTransaction this_arg_conv;
46530         this_arg_conv.inner = untag_ptr(this_arg);
46531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46533         this_arg_conv.is_owned = false;
46534         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
46535         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46536         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46537         Transaction_free(ret_var);
46538         return ret_arr;
46539 }
46540
46541 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) {
46542         LDKTrustedClosingTransaction this_arg_conv;
46543         this_arg_conv.inner = untag_ptr(this_arg);
46544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46546         this_arg_conv.is_owned = false;
46547         LDKu8slice funding_redeemscript_ref;
46548         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46549         funding_redeemscript_ref.data = funding_redeemscript->elems;
46550         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46551         memcpy(ret_arr->elems, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
46552         FREE(funding_redeemscript);
46553         return ret_arr;
46554 }
46555
46556 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) {
46557         LDKTrustedClosingTransaction this_arg_conv;
46558         this_arg_conv.inner = untag_ptr(this_arg);
46559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46561         this_arg_conv.is_owned = false;
46562         uint8_t funding_key_arr[32];
46563         CHECK(funding_key->arr_len == 32);
46564         memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key);
46565         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
46566         LDKu8slice funding_redeemscript_ref;
46567         funding_redeemscript_ref.datalen = funding_redeemscript->arr_len;
46568         funding_redeemscript_ref.data = funding_redeemscript->elems;
46569         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
46570         memcpy(ret_arr->elems, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
46571         FREE(funding_redeemscript);
46572         return ret_arr;
46573 }
46574
46575 void  __attribute__((export_name("TS_CommitmentTransaction_free"))) TS_CommitmentTransaction_free(uint64_t this_obj) {
46576         LDKCommitmentTransaction this_obj_conv;
46577         this_obj_conv.inner = untag_ptr(this_obj);
46578         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46580         CommitmentTransaction_free(this_obj_conv);
46581 }
46582
46583 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
46584         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
46585         uint64_t ret_ref = 0;
46586         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46587         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46588         return ret_ref;
46589 }
46590 int64_t  __attribute__((export_name("TS_CommitmentTransaction_clone_ptr"))) TS_CommitmentTransaction_clone_ptr(uint64_t arg) {
46591         LDKCommitmentTransaction arg_conv;
46592         arg_conv.inner = untag_ptr(arg);
46593         arg_conv.is_owned = ptr_is_owned(arg);
46594         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46595         arg_conv.is_owned = false;
46596         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
46597         return ret_conv;
46598 }
46599
46600 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_clone"))) TS_CommitmentTransaction_clone(uint64_t orig) {
46601         LDKCommitmentTransaction orig_conv;
46602         orig_conv.inner = untag_ptr(orig);
46603         orig_conv.is_owned = ptr_is_owned(orig);
46604         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46605         orig_conv.is_owned = false;
46606         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
46607         uint64_t ret_ref = 0;
46608         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46609         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46610         return ret_ref;
46611 }
46612
46613 int8_tArray  __attribute__((export_name("TS_CommitmentTransaction_write"))) TS_CommitmentTransaction_write(uint64_t obj) {
46614         LDKCommitmentTransaction obj_conv;
46615         obj_conv.inner = untag_ptr(obj);
46616         obj_conv.is_owned = ptr_is_owned(obj);
46617         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
46618         obj_conv.is_owned = false;
46619         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
46620         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
46621         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
46622         CVec_u8Z_free(ret_var);
46623         return ret_arr;
46624 }
46625
46626 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_read"))) TS_CommitmentTransaction_read(int8_tArray ser) {
46627         LDKu8slice ser_ref;
46628         ser_ref.datalen = ser->arr_len;
46629         ser_ref.data = ser->elems;
46630         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
46631         *ret_conv = CommitmentTransaction_read(ser_ref);
46632         FREE(ser);
46633         return tag_ptr(ret_conv, true);
46634 }
46635
46636 int64_t  __attribute__((export_name("TS_CommitmentTransaction_commitment_number"))) TS_CommitmentTransaction_commitment_number(uint64_t this_arg) {
46637         LDKCommitmentTransaction this_arg_conv;
46638         this_arg_conv.inner = untag_ptr(this_arg);
46639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46641         this_arg_conv.is_owned = false;
46642         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
46643         return ret_conv;
46644 }
46645
46646 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_broadcaster_value_sat"))) TS_CommitmentTransaction_to_broadcaster_value_sat(uint64_t this_arg) {
46647         LDKCommitmentTransaction this_arg_conv;
46648         this_arg_conv.inner = untag_ptr(this_arg);
46649         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46650         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46651         this_arg_conv.is_owned = false;
46652         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
46653         return ret_conv;
46654 }
46655
46656 int64_t  __attribute__((export_name("TS_CommitmentTransaction_to_countersignatory_value_sat"))) TS_CommitmentTransaction_to_countersignatory_value_sat(uint64_t this_arg) {
46657         LDKCommitmentTransaction this_arg_conv;
46658         this_arg_conv.inner = untag_ptr(this_arg);
46659         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46661         this_arg_conv.is_owned = false;
46662         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
46663         return ret_conv;
46664 }
46665
46666 int32_t  __attribute__((export_name("TS_CommitmentTransaction_feerate_per_kw"))) TS_CommitmentTransaction_feerate_per_kw(uint64_t this_arg) {
46667         LDKCommitmentTransaction this_arg_conv;
46668         this_arg_conv.inner = untag_ptr(this_arg);
46669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46671         this_arg_conv.is_owned = false;
46672         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
46673         return ret_conv;
46674 }
46675
46676 uint64_t  __attribute__((export_name("TS_CommitmentTransaction_trust"))) TS_CommitmentTransaction_trust(uint64_t this_arg) {
46677         LDKCommitmentTransaction this_arg_conv;
46678         this_arg_conv.inner = untag_ptr(this_arg);
46679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46681         this_arg_conv.is_owned = false;
46682         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
46683         uint64_t ret_ref = 0;
46684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46686         return ret_ref;
46687 }
46688
46689 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) {
46690         LDKCommitmentTransaction this_arg_conv;
46691         this_arg_conv.inner = untag_ptr(this_arg);
46692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46694         this_arg_conv.is_owned = false;
46695         LDKDirectedChannelTransactionParameters channel_parameters_conv;
46696         channel_parameters_conv.inner = untag_ptr(channel_parameters);
46697         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
46698         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
46699         channel_parameters_conv.is_owned = false;
46700         LDKChannelPublicKeys broadcaster_keys_conv;
46701         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
46702         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
46703         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
46704         broadcaster_keys_conv.is_owned = false;
46705         LDKChannelPublicKeys countersignatory_keys_conv;
46706         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
46707         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
46708         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
46709         countersignatory_keys_conv.is_owned = false;
46710         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
46711         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
46712         return tag_ptr(ret_conv, true);
46713 }
46714
46715 void  __attribute__((export_name("TS_TrustedCommitmentTransaction_free"))) TS_TrustedCommitmentTransaction_free(uint64_t this_obj) {
46716         LDKTrustedCommitmentTransaction this_obj_conv;
46717         this_obj_conv.inner = untag_ptr(this_obj);
46718         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46720         TrustedCommitmentTransaction_free(this_obj_conv);
46721 }
46722
46723 int8_tArray  __attribute__((export_name("TS_TrustedCommitmentTransaction_txid"))) TS_TrustedCommitmentTransaction_txid(uint64_t this_arg) {
46724         LDKTrustedCommitmentTransaction this_arg_conv;
46725         this_arg_conv.inner = untag_ptr(this_arg);
46726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46728         this_arg_conv.is_owned = false;
46729         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
46730         memcpy(ret_arr->elems, TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32);
46731         return ret_arr;
46732 }
46733
46734 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_built_transaction"))) TS_TrustedCommitmentTransaction_built_transaction(uint64_t this_arg) {
46735         LDKTrustedCommitmentTransaction this_arg_conv;
46736         this_arg_conv.inner = untag_ptr(this_arg);
46737         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46738         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46739         this_arg_conv.is_owned = false;
46740         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
46741         uint64_t ret_ref = 0;
46742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46744         return ret_ref;
46745 }
46746
46747 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_keys"))) TS_TrustedCommitmentTransaction_keys(uint64_t this_arg) {
46748         LDKTrustedCommitmentTransaction this_arg_conv;
46749         this_arg_conv.inner = untag_ptr(this_arg);
46750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46752         this_arg_conv.is_owned = false;
46753         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
46754         uint64_t ret_ref = 0;
46755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46757         return ret_ref;
46758 }
46759
46760 uint64_t  __attribute__((export_name("TS_TrustedCommitmentTransaction_channel_type_features"))) TS_TrustedCommitmentTransaction_channel_type_features(uint64_t this_arg) {
46761         LDKTrustedCommitmentTransaction this_arg_conv;
46762         this_arg_conv.inner = untag_ptr(this_arg);
46763         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46765         this_arg_conv.is_owned = false;
46766         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
46767         uint64_t ret_ref = 0;
46768         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46769         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46770         return ret_ref;
46771 }
46772
46773 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) {
46774         LDKTrustedCommitmentTransaction this_arg_conv;
46775         this_arg_conv.inner = untag_ptr(this_arg);
46776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
46777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
46778         this_arg_conv.is_owned = false;
46779         uint8_t htlc_base_key_arr[32];
46780         CHECK(htlc_base_key->arr_len == 32);
46781         memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key);
46782         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
46783         LDKDirectedChannelTransactionParameters channel_parameters_conv;
46784         channel_parameters_conv.inner = untag_ptr(channel_parameters);
46785         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
46786         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
46787         channel_parameters_conv.is_owned = false;
46788         void* entropy_source_ptr = untag_ptr(entropy_source);
46789         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
46790         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
46791         LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
46792         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
46793         return tag_ptr(ret_conv, true);
46794 }
46795
46796 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) {
46797         LDKPublicKey broadcaster_payment_basepoint_ref;
46798         CHECK(broadcaster_payment_basepoint->arr_len == 33);
46799         memcpy(broadcaster_payment_basepoint_ref.compressed_form, broadcaster_payment_basepoint->elems, 33); FREE(broadcaster_payment_basepoint);
46800         LDKPublicKey countersignatory_payment_basepoint_ref;
46801         CHECK(countersignatory_payment_basepoint->arr_len == 33);
46802         memcpy(countersignatory_payment_basepoint_ref.compressed_form, countersignatory_payment_basepoint->elems, 33); FREE(countersignatory_payment_basepoint);
46803         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
46804         return ret_conv;
46805 }
46806
46807 jboolean  __attribute__((export_name("TS_InitFeatures_eq"))) TS_InitFeatures_eq(uint64_t a, uint64_t b) {
46808         LDKInitFeatures a_conv;
46809         a_conv.inner = untag_ptr(a);
46810         a_conv.is_owned = ptr_is_owned(a);
46811         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46812         a_conv.is_owned = false;
46813         LDKInitFeatures b_conv;
46814         b_conv.inner = untag_ptr(b);
46815         b_conv.is_owned = ptr_is_owned(b);
46816         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46817         b_conv.is_owned = false;
46818         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
46819         return ret_conv;
46820 }
46821
46822 jboolean  __attribute__((export_name("TS_NodeFeatures_eq"))) TS_NodeFeatures_eq(uint64_t a, uint64_t b) {
46823         LDKNodeFeatures a_conv;
46824         a_conv.inner = untag_ptr(a);
46825         a_conv.is_owned = ptr_is_owned(a);
46826         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46827         a_conv.is_owned = false;
46828         LDKNodeFeatures b_conv;
46829         b_conv.inner = untag_ptr(b);
46830         b_conv.is_owned = ptr_is_owned(b);
46831         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46832         b_conv.is_owned = false;
46833         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
46834         return ret_conv;
46835 }
46836
46837 jboolean  __attribute__((export_name("TS_ChannelFeatures_eq"))) TS_ChannelFeatures_eq(uint64_t a, uint64_t b) {
46838         LDKChannelFeatures a_conv;
46839         a_conv.inner = untag_ptr(a);
46840         a_conv.is_owned = ptr_is_owned(a);
46841         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46842         a_conv.is_owned = false;
46843         LDKChannelFeatures b_conv;
46844         b_conv.inner = untag_ptr(b);
46845         b_conv.is_owned = ptr_is_owned(b);
46846         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46847         b_conv.is_owned = false;
46848         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
46849         return ret_conv;
46850 }
46851
46852 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_eq"))) TS_Bolt11InvoiceFeatures_eq(uint64_t a, uint64_t b) {
46853         LDKBolt11InvoiceFeatures a_conv;
46854         a_conv.inner = untag_ptr(a);
46855         a_conv.is_owned = ptr_is_owned(a);
46856         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46857         a_conv.is_owned = false;
46858         LDKBolt11InvoiceFeatures b_conv;
46859         b_conv.inner = untag_ptr(b);
46860         b_conv.is_owned = ptr_is_owned(b);
46861         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46862         b_conv.is_owned = false;
46863         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
46864         return ret_conv;
46865 }
46866
46867 jboolean  __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) {
46868         LDKOfferFeatures a_conv;
46869         a_conv.inner = untag_ptr(a);
46870         a_conv.is_owned = ptr_is_owned(a);
46871         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46872         a_conv.is_owned = false;
46873         LDKOfferFeatures b_conv;
46874         b_conv.inner = untag_ptr(b);
46875         b_conv.is_owned = ptr_is_owned(b);
46876         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46877         b_conv.is_owned = false;
46878         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
46879         return ret_conv;
46880 }
46881
46882 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) {
46883         LDKInvoiceRequestFeatures a_conv;
46884         a_conv.inner = untag_ptr(a);
46885         a_conv.is_owned = ptr_is_owned(a);
46886         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46887         a_conv.is_owned = false;
46888         LDKInvoiceRequestFeatures b_conv;
46889         b_conv.inner = untag_ptr(b);
46890         b_conv.is_owned = ptr_is_owned(b);
46891         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46892         b_conv.is_owned = false;
46893         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
46894         return ret_conv;
46895 }
46896
46897 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) {
46898         LDKBolt12InvoiceFeatures a_conv;
46899         a_conv.inner = untag_ptr(a);
46900         a_conv.is_owned = ptr_is_owned(a);
46901         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46902         a_conv.is_owned = false;
46903         LDKBolt12InvoiceFeatures b_conv;
46904         b_conv.inner = untag_ptr(b);
46905         b_conv.is_owned = ptr_is_owned(b);
46906         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46907         b_conv.is_owned = false;
46908         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
46909         return ret_conv;
46910 }
46911
46912 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) {
46913         LDKBlindedHopFeatures a_conv;
46914         a_conv.inner = untag_ptr(a);
46915         a_conv.is_owned = ptr_is_owned(a);
46916         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46917         a_conv.is_owned = false;
46918         LDKBlindedHopFeatures b_conv;
46919         b_conv.inner = untag_ptr(b);
46920         b_conv.is_owned = ptr_is_owned(b);
46921         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46922         b_conv.is_owned = false;
46923         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
46924         return ret_conv;
46925 }
46926
46927 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) {
46928         LDKChannelTypeFeatures a_conv;
46929         a_conv.inner = untag_ptr(a);
46930         a_conv.is_owned = ptr_is_owned(a);
46931         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46932         a_conv.is_owned = false;
46933         LDKChannelTypeFeatures b_conv;
46934         b_conv.inner = untag_ptr(b);
46935         b_conv.is_owned = ptr_is_owned(b);
46936         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46937         b_conv.is_owned = false;
46938         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
46939         return ret_conv;
46940 }
46941
46942 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
46943         LDKInitFeatures ret_var = InitFeatures_clone(arg);
46944         uint64_t ret_ref = 0;
46945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46947         return ret_ref;
46948 }
46949 int64_t  __attribute__((export_name("TS_InitFeatures_clone_ptr"))) TS_InitFeatures_clone_ptr(uint64_t arg) {
46950         LDKInitFeatures arg_conv;
46951         arg_conv.inner = untag_ptr(arg);
46952         arg_conv.is_owned = ptr_is_owned(arg);
46953         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46954         arg_conv.is_owned = false;
46955         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
46956         return ret_conv;
46957 }
46958
46959 uint64_t  __attribute__((export_name("TS_InitFeatures_clone"))) TS_InitFeatures_clone(uint64_t orig) {
46960         LDKInitFeatures orig_conv;
46961         orig_conv.inner = untag_ptr(orig);
46962         orig_conv.is_owned = ptr_is_owned(orig);
46963         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46964         orig_conv.is_owned = false;
46965         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
46966         uint64_t ret_ref = 0;
46967         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46968         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46969         return ret_ref;
46970 }
46971
46972 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
46973         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
46974         uint64_t ret_ref = 0;
46975         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46976         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46977         return ret_ref;
46978 }
46979 int64_t  __attribute__((export_name("TS_NodeFeatures_clone_ptr"))) TS_NodeFeatures_clone_ptr(uint64_t arg) {
46980         LDKNodeFeatures arg_conv;
46981         arg_conv.inner = untag_ptr(arg);
46982         arg_conv.is_owned = ptr_is_owned(arg);
46983         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46984         arg_conv.is_owned = false;
46985         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
46986         return ret_conv;
46987 }
46988
46989 uint64_t  __attribute__((export_name("TS_NodeFeatures_clone"))) TS_NodeFeatures_clone(uint64_t orig) {
46990         LDKNodeFeatures orig_conv;
46991         orig_conv.inner = untag_ptr(orig);
46992         orig_conv.is_owned = ptr_is_owned(orig);
46993         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46994         orig_conv.is_owned = false;
46995         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
46996         uint64_t ret_ref = 0;
46997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46999         return ret_ref;
47000 }
47001
47002 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
47003         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
47004         uint64_t ret_ref = 0;
47005         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47006         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47007         return ret_ref;
47008 }
47009 int64_t  __attribute__((export_name("TS_ChannelFeatures_clone_ptr"))) TS_ChannelFeatures_clone_ptr(uint64_t arg) {
47010         LDKChannelFeatures arg_conv;
47011         arg_conv.inner = untag_ptr(arg);
47012         arg_conv.is_owned = ptr_is_owned(arg);
47013         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47014         arg_conv.is_owned = false;
47015         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
47016         return ret_conv;
47017 }
47018
47019 uint64_t  __attribute__((export_name("TS_ChannelFeatures_clone"))) TS_ChannelFeatures_clone(uint64_t orig) {
47020         LDKChannelFeatures orig_conv;
47021         orig_conv.inner = untag_ptr(orig);
47022         orig_conv.is_owned = ptr_is_owned(orig);
47023         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47024         orig_conv.is_owned = false;
47025         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
47026         uint64_t ret_ref = 0;
47027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47029         return ret_ref;
47030 }
47031
47032 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
47033         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
47034         uint64_t ret_ref = 0;
47035         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47036         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47037         return ret_ref;
47038 }
47039 int64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone_ptr"))) TS_Bolt11InvoiceFeatures_clone_ptr(uint64_t arg) {
47040         LDKBolt11InvoiceFeatures arg_conv;
47041         arg_conv.inner = untag_ptr(arg);
47042         arg_conv.is_owned = ptr_is_owned(arg);
47043         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47044         arg_conv.is_owned = false;
47045         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
47046         return ret_conv;
47047 }
47048
47049 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_clone"))) TS_Bolt11InvoiceFeatures_clone(uint64_t orig) {
47050         LDKBolt11InvoiceFeatures orig_conv;
47051         orig_conv.inner = untag_ptr(orig);
47052         orig_conv.is_owned = ptr_is_owned(orig);
47053         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47054         orig_conv.is_owned = false;
47055         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_conv);
47056         uint64_t ret_ref = 0;
47057         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47058         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47059         return ret_ref;
47060 }
47061
47062 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
47063         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
47064         uint64_t ret_ref = 0;
47065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47067         return ret_ref;
47068 }
47069 int64_t  __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) {
47070         LDKOfferFeatures arg_conv;
47071         arg_conv.inner = untag_ptr(arg);
47072         arg_conv.is_owned = ptr_is_owned(arg);
47073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47074         arg_conv.is_owned = false;
47075         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
47076         return ret_conv;
47077 }
47078
47079 uint64_t  __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) {
47080         LDKOfferFeatures orig_conv;
47081         orig_conv.inner = untag_ptr(orig);
47082         orig_conv.is_owned = ptr_is_owned(orig);
47083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47084         orig_conv.is_owned = false;
47085         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
47086         uint64_t ret_ref = 0;
47087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47089         return ret_ref;
47090 }
47091
47092 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
47093         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
47094         uint64_t ret_ref = 0;
47095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47097         return ret_ref;
47098 }
47099 int64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) {
47100         LDKInvoiceRequestFeatures arg_conv;
47101         arg_conv.inner = untag_ptr(arg);
47102         arg_conv.is_owned = ptr_is_owned(arg);
47103         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47104         arg_conv.is_owned = false;
47105         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
47106         return ret_conv;
47107 }
47108
47109 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) {
47110         LDKInvoiceRequestFeatures orig_conv;
47111         orig_conv.inner = untag_ptr(orig);
47112         orig_conv.is_owned = ptr_is_owned(orig);
47113         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47114         orig_conv.is_owned = false;
47115         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
47116         uint64_t ret_ref = 0;
47117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47119         return ret_ref;
47120 }
47121
47122 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
47123         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
47124         uint64_t ret_ref = 0;
47125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47127         return ret_ref;
47128 }
47129 int64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) {
47130         LDKBolt12InvoiceFeatures arg_conv;
47131         arg_conv.inner = untag_ptr(arg);
47132         arg_conv.is_owned = ptr_is_owned(arg);
47133         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47134         arg_conv.is_owned = false;
47135         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
47136         return ret_conv;
47137 }
47138
47139 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) {
47140         LDKBolt12InvoiceFeatures orig_conv;
47141         orig_conv.inner = untag_ptr(orig);
47142         orig_conv.is_owned = ptr_is_owned(orig);
47143         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47144         orig_conv.is_owned = false;
47145         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
47146         uint64_t ret_ref = 0;
47147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47149         return ret_ref;
47150 }
47151
47152 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
47153         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
47154         uint64_t ret_ref = 0;
47155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47157         return ret_ref;
47158 }
47159 int64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) {
47160         LDKBlindedHopFeatures arg_conv;
47161         arg_conv.inner = untag_ptr(arg);
47162         arg_conv.is_owned = ptr_is_owned(arg);
47163         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47164         arg_conv.is_owned = false;
47165         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
47166         return ret_conv;
47167 }
47168
47169 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) {
47170         LDKBlindedHopFeatures orig_conv;
47171         orig_conv.inner = untag_ptr(orig);
47172         orig_conv.is_owned = ptr_is_owned(orig);
47173         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47174         orig_conv.is_owned = false;
47175         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
47176         uint64_t ret_ref = 0;
47177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47179         return ret_ref;
47180 }
47181
47182 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
47183         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
47184         uint64_t ret_ref = 0;
47185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47187         return ret_ref;
47188 }
47189 int64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone_ptr"))) TS_ChannelTypeFeatures_clone_ptr(uint64_t arg) {
47190         LDKChannelTypeFeatures arg_conv;
47191         arg_conv.inner = untag_ptr(arg);
47192         arg_conv.is_owned = ptr_is_owned(arg);
47193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47194         arg_conv.is_owned = false;
47195         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
47196         return ret_conv;
47197 }
47198
47199 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_clone"))) TS_ChannelTypeFeatures_clone(uint64_t orig) {
47200         LDKChannelTypeFeatures orig_conv;
47201         orig_conv.inner = untag_ptr(orig);
47202         orig_conv.is_owned = ptr_is_owned(orig);
47203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47204         orig_conv.is_owned = false;
47205         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
47206         uint64_t ret_ref = 0;
47207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47209         return ret_ref;
47210 }
47211
47212 void  __attribute__((export_name("TS_InitFeatures_free"))) TS_InitFeatures_free(uint64_t this_obj) {
47213         LDKInitFeatures this_obj_conv;
47214         this_obj_conv.inner = untag_ptr(this_obj);
47215         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47217         InitFeatures_free(this_obj_conv);
47218 }
47219
47220 void  __attribute__((export_name("TS_NodeFeatures_free"))) TS_NodeFeatures_free(uint64_t this_obj) {
47221         LDKNodeFeatures this_obj_conv;
47222         this_obj_conv.inner = untag_ptr(this_obj);
47223         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47225         NodeFeatures_free(this_obj_conv);
47226 }
47227
47228 void  __attribute__((export_name("TS_ChannelFeatures_free"))) TS_ChannelFeatures_free(uint64_t this_obj) {
47229         LDKChannelFeatures this_obj_conv;
47230         this_obj_conv.inner = untag_ptr(this_obj);
47231         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47233         ChannelFeatures_free(this_obj_conv);
47234 }
47235
47236 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_free"))) TS_Bolt11InvoiceFeatures_free(uint64_t this_obj) {
47237         LDKBolt11InvoiceFeatures this_obj_conv;
47238         this_obj_conv.inner = untag_ptr(this_obj);
47239         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47240         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47241         Bolt11InvoiceFeatures_free(this_obj_conv);
47242 }
47243
47244 void  __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) {
47245         LDKOfferFeatures this_obj_conv;
47246         this_obj_conv.inner = untag_ptr(this_obj);
47247         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47249         OfferFeatures_free(this_obj_conv);
47250 }
47251
47252 void  __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) {
47253         LDKInvoiceRequestFeatures this_obj_conv;
47254         this_obj_conv.inner = untag_ptr(this_obj);
47255         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47257         InvoiceRequestFeatures_free(this_obj_conv);
47258 }
47259
47260 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) {
47261         LDKBolt12InvoiceFeatures this_obj_conv;
47262         this_obj_conv.inner = untag_ptr(this_obj);
47263         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47265         Bolt12InvoiceFeatures_free(this_obj_conv);
47266 }
47267
47268 void  __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) {
47269         LDKBlindedHopFeatures this_obj_conv;
47270         this_obj_conv.inner = untag_ptr(this_obj);
47271         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47273         BlindedHopFeatures_free(this_obj_conv);
47274 }
47275
47276 void  __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) {
47277         LDKChannelTypeFeatures this_obj_conv;
47278         this_obj_conv.inner = untag_ptr(this_obj);
47279         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47281         ChannelTypeFeatures_free(this_obj_conv);
47282 }
47283
47284 uint64_t  __attribute__((export_name("TS_InitFeatures_empty"))) TS_InitFeatures_empty() {
47285         LDKInitFeatures ret_var = InitFeatures_empty();
47286         uint64_t ret_ref = 0;
47287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47289         return ret_ref;
47290 }
47291
47292 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits_from"))) TS_InitFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47293         LDKInitFeatures this_arg_conv;
47294         this_arg_conv.inner = untag_ptr(this_arg);
47295         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47297         this_arg_conv.is_owned = false;
47298         LDKInitFeatures other_conv;
47299         other_conv.inner = untag_ptr(other);
47300         other_conv.is_owned = ptr_is_owned(other);
47301         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47302         other_conv.is_owned = false;
47303         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47304         return ret_conv;
47305 }
47306
47307 jboolean  __attribute__((export_name("TS_InitFeatures_requires_unknown_bits"))) TS_InitFeatures_requires_unknown_bits(uint64_t this_arg) {
47308         LDKInitFeatures this_arg_conv;
47309         this_arg_conv.inner = untag_ptr(this_arg);
47310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47312         this_arg_conv.is_owned = false;
47313         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
47314         return ret_conv;
47315 }
47316
47317 uint64_t  __attribute__((export_name("TS_InitFeatures_set_required_custom_bit"))) TS_InitFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47318         LDKInitFeatures this_arg_conv;
47319         this_arg_conv.inner = untag_ptr(this_arg);
47320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47322         this_arg_conv.is_owned = false;
47323         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47324         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
47325         return tag_ptr(ret_conv, true);
47326 }
47327
47328 uint64_t  __attribute__((export_name("TS_InitFeatures_set_optional_custom_bit"))) TS_InitFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47329         LDKInitFeatures this_arg_conv;
47330         this_arg_conv.inner = untag_ptr(this_arg);
47331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47333         this_arg_conv.is_owned = false;
47334         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47335         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47336         return tag_ptr(ret_conv, true);
47337 }
47338
47339 uint64_t  __attribute__((export_name("TS_NodeFeatures_empty"))) TS_NodeFeatures_empty() {
47340         LDKNodeFeatures ret_var = NodeFeatures_empty();
47341         uint64_t ret_ref = 0;
47342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47344         return ret_ref;
47345 }
47346
47347 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits_from"))) TS_NodeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47348         LDKNodeFeatures this_arg_conv;
47349         this_arg_conv.inner = untag_ptr(this_arg);
47350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47352         this_arg_conv.is_owned = false;
47353         LDKNodeFeatures other_conv;
47354         other_conv.inner = untag_ptr(other);
47355         other_conv.is_owned = ptr_is_owned(other);
47356         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47357         other_conv.is_owned = false;
47358         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47359         return ret_conv;
47360 }
47361
47362 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_unknown_bits"))) TS_NodeFeatures_requires_unknown_bits(uint64_t this_arg) {
47363         LDKNodeFeatures this_arg_conv;
47364         this_arg_conv.inner = untag_ptr(this_arg);
47365         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47366         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47367         this_arg_conv.is_owned = false;
47368         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
47369         return ret_conv;
47370 }
47371
47372 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_required_custom_bit"))) TS_NodeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47373         LDKNodeFeatures this_arg_conv;
47374         this_arg_conv.inner = untag_ptr(this_arg);
47375         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47377         this_arg_conv.is_owned = false;
47378         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47379         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
47380         return tag_ptr(ret_conv, true);
47381 }
47382
47383 uint64_t  __attribute__((export_name("TS_NodeFeatures_set_optional_custom_bit"))) TS_NodeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47384         LDKNodeFeatures this_arg_conv;
47385         this_arg_conv.inner = untag_ptr(this_arg);
47386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47388         this_arg_conv.is_owned = false;
47389         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47390         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47391         return tag_ptr(ret_conv, true);
47392 }
47393
47394 uint64_t  __attribute__((export_name("TS_ChannelFeatures_empty"))) TS_ChannelFeatures_empty() {
47395         LDKChannelFeatures ret_var = ChannelFeatures_empty();
47396         uint64_t ret_ref = 0;
47397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47399         return ret_ref;
47400 }
47401
47402 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits_from"))) TS_ChannelFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47403         LDKChannelFeatures this_arg_conv;
47404         this_arg_conv.inner = untag_ptr(this_arg);
47405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47407         this_arg_conv.is_owned = false;
47408         LDKChannelFeatures other_conv;
47409         other_conv.inner = untag_ptr(other);
47410         other_conv.is_owned = ptr_is_owned(other);
47411         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47412         other_conv.is_owned = false;
47413         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47414         return ret_conv;
47415 }
47416
47417 jboolean  __attribute__((export_name("TS_ChannelFeatures_requires_unknown_bits"))) TS_ChannelFeatures_requires_unknown_bits(uint64_t this_arg) {
47418         LDKChannelFeatures this_arg_conv;
47419         this_arg_conv.inner = untag_ptr(this_arg);
47420         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47422         this_arg_conv.is_owned = false;
47423         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
47424         return ret_conv;
47425 }
47426
47427 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_required_custom_bit"))) TS_ChannelFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47428         LDKChannelFeatures this_arg_conv;
47429         this_arg_conv.inner = untag_ptr(this_arg);
47430         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47432         this_arg_conv.is_owned = false;
47433         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47434         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
47435         return tag_ptr(ret_conv, true);
47436 }
47437
47438 uint64_t  __attribute__((export_name("TS_ChannelFeatures_set_optional_custom_bit"))) TS_ChannelFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47439         LDKChannelFeatures this_arg_conv;
47440         this_arg_conv.inner = untag_ptr(this_arg);
47441         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47443         this_arg_conv.is_owned = false;
47444         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47445         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47446         return tag_ptr(ret_conv, true);
47447 }
47448
47449 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_empty"))) TS_Bolt11InvoiceFeatures_empty() {
47450         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
47451         uint64_t ret_ref = 0;
47452         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47453         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47454         return ret_ref;
47455 }
47456
47457 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47458         LDKBolt11InvoiceFeatures this_arg_conv;
47459         this_arg_conv.inner = untag_ptr(this_arg);
47460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47462         this_arg_conv.is_owned = false;
47463         LDKBolt11InvoiceFeatures other_conv;
47464         other_conv.inner = untag_ptr(other);
47465         other_conv.is_owned = ptr_is_owned(other);
47466         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47467         other_conv.is_owned = false;
47468         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47469         return ret_conv;
47470 }
47471
47472 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_unknown_bits"))) TS_Bolt11InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
47473         LDKBolt11InvoiceFeatures this_arg_conv;
47474         this_arg_conv.inner = untag_ptr(this_arg);
47475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47477         this_arg_conv.is_owned = false;
47478         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
47479         return ret_conv;
47480 }
47481
47482 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_required_custom_bit"))) TS_Bolt11InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47483         LDKBolt11InvoiceFeatures this_arg_conv;
47484         this_arg_conv.inner = untag_ptr(this_arg);
47485         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47487         this_arg_conv.is_owned = false;
47488         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47489         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
47490         return tag_ptr(ret_conv, true);
47491 }
47492
47493 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt11InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47494         LDKBolt11InvoiceFeatures this_arg_conv;
47495         this_arg_conv.inner = untag_ptr(this_arg);
47496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47498         this_arg_conv.is_owned = false;
47499         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47500         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47501         return tag_ptr(ret_conv, true);
47502 }
47503
47504 uint64_t  __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() {
47505         LDKOfferFeatures ret_var = OfferFeatures_empty();
47506         uint64_t ret_ref = 0;
47507         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47508         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47509         return ret_ref;
47510 }
47511
47512 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits_from"))) TS_OfferFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47513         LDKOfferFeatures this_arg_conv;
47514         this_arg_conv.inner = untag_ptr(this_arg);
47515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47517         this_arg_conv.is_owned = false;
47518         LDKOfferFeatures other_conv;
47519         other_conv.inner = untag_ptr(other);
47520         other_conv.is_owned = ptr_is_owned(other);
47521         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47522         other_conv.is_owned = false;
47523         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47524         return ret_conv;
47525 }
47526
47527 jboolean  __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) {
47528         LDKOfferFeatures this_arg_conv;
47529         this_arg_conv.inner = untag_ptr(this_arg);
47530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47532         this_arg_conv.is_owned = false;
47533         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
47534         return ret_conv;
47535 }
47536
47537 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_required_custom_bit"))) TS_OfferFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47538         LDKOfferFeatures this_arg_conv;
47539         this_arg_conv.inner = untag_ptr(this_arg);
47540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47542         this_arg_conv.is_owned = false;
47543         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47544         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
47545         return tag_ptr(ret_conv, true);
47546 }
47547
47548 uint64_t  __attribute__((export_name("TS_OfferFeatures_set_optional_custom_bit"))) TS_OfferFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47549         LDKOfferFeatures this_arg_conv;
47550         this_arg_conv.inner = untag_ptr(this_arg);
47551         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47553         this_arg_conv.is_owned = false;
47554         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47555         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47556         return tag_ptr(ret_conv, true);
47557 }
47558
47559 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() {
47560         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
47561         uint64_t ret_ref = 0;
47562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47564         return ret_ref;
47565 }
47566
47567 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits_from"))) TS_InvoiceRequestFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47568         LDKInvoiceRequestFeatures this_arg_conv;
47569         this_arg_conv.inner = untag_ptr(this_arg);
47570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47572         this_arg_conv.is_owned = false;
47573         LDKInvoiceRequestFeatures other_conv;
47574         other_conv.inner = untag_ptr(other);
47575         other_conv.is_owned = ptr_is_owned(other);
47576         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47577         other_conv.is_owned = false;
47578         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47579         return ret_conv;
47580 }
47581
47582 jboolean  __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) {
47583         LDKInvoiceRequestFeatures this_arg_conv;
47584         this_arg_conv.inner = untag_ptr(this_arg);
47585         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47587         this_arg_conv.is_owned = false;
47588         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
47589         return ret_conv;
47590 }
47591
47592 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_required_custom_bit"))) TS_InvoiceRequestFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47593         LDKInvoiceRequestFeatures this_arg_conv;
47594         this_arg_conv.inner = untag_ptr(this_arg);
47595         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47597         this_arg_conv.is_owned = false;
47598         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47599         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
47600         return tag_ptr(ret_conv, true);
47601 }
47602
47603 uint64_t  __attribute__((export_name("TS_InvoiceRequestFeatures_set_optional_custom_bit"))) TS_InvoiceRequestFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47604         LDKInvoiceRequestFeatures this_arg_conv;
47605         this_arg_conv.inner = untag_ptr(this_arg);
47606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47608         this_arg_conv.is_owned = false;
47609         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47610         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47611         return tag_ptr(ret_conv, true);
47612 }
47613
47614 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() {
47615         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
47616         uint64_t ret_ref = 0;
47617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47619         return ret_ref;
47620 }
47621
47622 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits_from"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47623         LDKBolt12InvoiceFeatures this_arg_conv;
47624         this_arg_conv.inner = untag_ptr(this_arg);
47625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47627         this_arg_conv.is_owned = false;
47628         LDKBolt12InvoiceFeatures other_conv;
47629         other_conv.inner = untag_ptr(other);
47630         other_conv.is_owned = ptr_is_owned(other);
47631         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47632         other_conv.is_owned = false;
47633         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47634         return ret_conv;
47635 }
47636
47637 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) {
47638         LDKBolt12InvoiceFeatures this_arg_conv;
47639         this_arg_conv.inner = untag_ptr(this_arg);
47640         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47642         this_arg_conv.is_owned = false;
47643         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
47644         return ret_conv;
47645 }
47646
47647 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_required_custom_bit"))) TS_Bolt12InvoiceFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47648         LDKBolt12InvoiceFeatures this_arg_conv;
47649         this_arg_conv.inner = untag_ptr(this_arg);
47650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47652         this_arg_conv.is_owned = false;
47653         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47654         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
47655         return tag_ptr(ret_conv, true);
47656 }
47657
47658 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_optional_custom_bit"))) TS_Bolt12InvoiceFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47659         LDKBolt12InvoiceFeatures this_arg_conv;
47660         this_arg_conv.inner = untag_ptr(this_arg);
47661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47663         this_arg_conv.is_owned = false;
47664         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47665         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47666         return tag_ptr(ret_conv, true);
47667 }
47668
47669 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() {
47670         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
47671         uint64_t ret_ref = 0;
47672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47674         return ret_ref;
47675 }
47676
47677 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits_from"))) TS_BlindedHopFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47678         LDKBlindedHopFeatures this_arg_conv;
47679         this_arg_conv.inner = untag_ptr(this_arg);
47680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47682         this_arg_conv.is_owned = false;
47683         LDKBlindedHopFeatures other_conv;
47684         other_conv.inner = untag_ptr(other);
47685         other_conv.is_owned = ptr_is_owned(other);
47686         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47687         other_conv.is_owned = false;
47688         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47689         return ret_conv;
47690 }
47691
47692 jboolean  __attribute__((export_name("TS_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) {
47693         LDKBlindedHopFeatures this_arg_conv;
47694         this_arg_conv.inner = untag_ptr(this_arg);
47695         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47697         this_arg_conv.is_owned = false;
47698         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
47699         return ret_conv;
47700 }
47701
47702 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_required_custom_bit"))) TS_BlindedHopFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47703         LDKBlindedHopFeatures this_arg_conv;
47704         this_arg_conv.inner = untag_ptr(this_arg);
47705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47707         this_arg_conv.is_owned = false;
47708         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47709         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
47710         return tag_ptr(ret_conv, true);
47711 }
47712
47713 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_set_optional_custom_bit"))) TS_BlindedHopFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47714         LDKBlindedHopFeatures this_arg_conv;
47715         this_arg_conv.inner = untag_ptr(this_arg);
47716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47718         this_arg_conv.is_owned = false;
47719         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47720         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47721         return tag_ptr(ret_conv, true);
47722 }
47723
47724 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() {
47725         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
47726         uint64_t ret_ref = 0;
47727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47729         return ret_ref;
47730 }
47731
47732 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits_from"))) TS_ChannelTypeFeatures_requires_unknown_bits_from(uint64_t this_arg, uint64_t other) {
47733         LDKChannelTypeFeatures this_arg_conv;
47734         this_arg_conv.inner = untag_ptr(this_arg);
47735         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47737         this_arg_conv.is_owned = false;
47738         LDKChannelTypeFeatures other_conv;
47739         other_conv.inner = untag_ptr(other);
47740         other_conv.is_owned = ptr_is_owned(other);
47741         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
47742         other_conv.is_owned = false;
47743         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
47744         return ret_conv;
47745 }
47746
47747 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_unknown_bits"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint64_t this_arg) {
47748         LDKChannelTypeFeatures this_arg_conv;
47749         this_arg_conv.inner = untag_ptr(this_arg);
47750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47752         this_arg_conv.is_owned = false;
47753         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
47754         return ret_conv;
47755 }
47756
47757 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_required_custom_bit"))) TS_ChannelTypeFeatures_set_required_custom_bit(uint64_t this_arg, uint32_t bit) {
47758         LDKChannelTypeFeatures this_arg_conv;
47759         this_arg_conv.inner = untag_ptr(this_arg);
47760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47762         this_arg_conv.is_owned = false;
47763         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47764         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
47765         return tag_ptr(ret_conv, true);
47766 }
47767
47768 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_set_optional_custom_bit"))) TS_ChannelTypeFeatures_set_optional_custom_bit(uint64_t this_arg, uint32_t bit) {
47769         LDKChannelTypeFeatures this_arg_conv;
47770         this_arg_conv.inner = untag_ptr(this_arg);
47771         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47772         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47773         this_arg_conv.is_owned = false;
47774         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
47775         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
47776         return tag_ptr(ret_conv, true);
47777 }
47778
47779 int8_tArray  __attribute__((export_name("TS_InitFeatures_write"))) TS_InitFeatures_write(uint64_t obj) {
47780         LDKInitFeatures obj_conv;
47781         obj_conv.inner = untag_ptr(obj);
47782         obj_conv.is_owned = ptr_is_owned(obj);
47783         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47784         obj_conv.is_owned = false;
47785         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
47786         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47787         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47788         CVec_u8Z_free(ret_var);
47789         return ret_arr;
47790 }
47791
47792 uint64_t  __attribute__((export_name("TS_InitFeatures_read"))) TS_InitFeatures_read(int8_tArray ser) {
47793         LDKu8slice ser_ref;
47794         ser_ref.datalen = ser->arr_len;
47795         ser_ref.data = ser->elems;
47796         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
47797         *ret_conv = InitFeatures_read(ser_ref);
47798         FREE(ser);
47799         return tag_ptr(ret_conv, true);
47800 }
47801
47802 int8_tArray  __attribute__((export_name("TS_ChannelFeatures_write"))) TS_ChannelFeatures_write(uint64_t obj) {
47803         LDKChannelFeatures obj_conv;
47804         obj_conv.inner = untag_ptr(obj);
47805         obj_conv.is_owned = ptr_is_owned(obj);
47806         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47807         obj_conv.is_owned = false;
47808         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
47809         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47810         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47811         CVec_u8Z_free(ret_var);
47812         return ret_arr;
47813 }
47814
47815 uint64_t  __attribute__((export_name("TS_ChannelFeatures_read"))) TS_ChannelFeatures_read(int8_tArray ser) {
47816         LDKu8slice ser_ref;
47817         ser_ref.datalen = ser->arr_len;
47818         ser_ref.data = ser->elems;
47819         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
47820         *ret_conv = ChannelFeatures_read(ser_ref);
47821         FREE(ser);
47822         return tag_ptr(ret_conv, true);
47823 }
47824
47825 int8_tArray  __attribute__((export_name("TS_NodeFeatures_write"))) TS_NodeFeatures_write(uint64_t obj) {
47826         LDKNodeFeatures obj_conv;
47827         obj_conv.inner = untag_ptr(obj);
47828         obj_conv.is_owned = ptr_is_owned(obj);
47829         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47830         obj_conv.is_owned = false;
47831         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
47832         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47833         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47834         CVec_u8Z_free(ret_var);
47835         return ret_arr;
47836 }
47837
47838 uint64_t  __attribute__((export_name("TS_NodeFeatures_read"))) TS_NodeFeatures_read(int8_tArray ser) {
47839         LDKu8slice ser_ref;
47840         ser_ref.datalen = ser->arr_len;
47841         ser_ref.data = ser->elems;
47842         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
47843         *ret_conv = NodeFeatures_read(ser_ref);
47844         FREE(ser);
47845         return tag_ptr(ret_conv, true);
47846 }
47847
47848 int8_tArray  __attribute__((export_name("TS_Bolt11InvoiceFeatures_write"))) TS_Bolt11InvoiceFeatures_write(uint64_t obj) {
47849         LDKBolt11InvoiceFeatures obj_conv;
47850         obj_conv.inner = untag_ptr(obj);
47851         obj_conv.is_owned = ptr_is_owned(obj);
47852         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47853         obj_conv.is_owned = false;
47854         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
47855         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47856         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47857         CVec_u8Z_free(ret_var);
47858         return ret_arr;
47859 }
47860
47861 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceFeatures_read"))) TS_Bolt11InvoiceFeatures_read(int8_tArray ser) {
47862         LDKu8slice ser_ref;
47863         ser_ref.datalen = ser->arr_len;
47864         ser_ref.data = ser->elems;
47865         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
47866         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
47867         FREE(ser);
47868         return tag_ptr(ret_conv, true);
47869 }
47870
47871 int8_tArray  __attribute__((export_name("TS_Bolt12InvoiceFeatures_write"))) TS_Bolt12InvoiceFeatures_write(uint64_t obj) {
47872         LDKBolt12InvoiceFeatures obj_conv;
47873         obj_conv.inner = untag_ptr(obj);
47874         obj_conv.is_owned = ptr_is_owned(obj);
47875         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47876         obj_conv.is_owned = false;
47877         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
47878         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47879         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47880         CVec_u8Z_free(ret_var);
47881         return ret_arr;
47882 }
47883
47884 uint64_t  __attribute__((export_name("TS_Bolt12InvoiceFeatures_read"))) TS_Bolt12InvoiceFeatures_read(int8_tArray ser) {
47885         LDKu8slice ser_ref;
47886         ser_ref.datalen = ser->arr_len;
47887         ser_ref.data = ser->elems;
47888         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
47889         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
47890         FREE(ser);
47891         return tag_ptr(ret_conv, true);
47892 }
47893
47894 int8_tArray  __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) {
47895         LDKBlindedHopFeatures obj_conv;
47896         obj_conv.inner = untag_ptr(obj);
47897         obj_conv.is_owned = ptr_is_owned(obj);
47898         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47899         obj_conv.is_owned = false;
47900         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
47901         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47902         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47903         CVec_u8Z_free(ret_var);
47904         return ret_arr;
47905 }
47906
47907 uint64_t  __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_read(int8_tArray ser) {
47908         LDKu8slice ser_ref;
47909         ser_ref.datalen = ser->arr_len;
47910         ser_ref.data = ser->elems;
47911         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
47912         *ret_conv = BlindedHopFeatures_read(ser_ref);
47913         FREE(ser);
47914         return tag_ptr(ret_conv, true);
47915 }
47916
47917 int8_tArray  __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) {
47918         LDKChannelTypeFeatures obj_conv;
47919         obj_conv.inner = untag_ptr(obj);
47920         obj_conv.is_owned = ptr_is_owned(obj);
47921         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
47922         obj_conv.is_owned = false;
47923         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
47924         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
47925         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
47926         CVec_u8Z_free(ret_var);
47927         return ret_arr;
47928 }
47929
47930 uint64_t  __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) {
47931         LDKu8slice ser_ref;
47932         ser_ref.datalen = ser->arr_len;
47933         ser_ref.data = ser->elems;
47934         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
47935         *ret_conv = ChannelTypeFeatures_read(ser_ref);
47936         FREE(ser);
47937         return tag_ptr(ret_conv, true);
47938 }
47939
47940 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
47941         LDKInitFeatures this_arg_conv;
47942         this_arg_conv.inner = untag_ptr(this_arg);
47943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47945         this_arg_conv.is_owned = false;
47946         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
47947 }
47948
47949 void  __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_required"))) TS_InitFeatures_set_data_loss_protect_required(uint64_t this_arg) {
47950         LDKInitFeatures this_arg_conv;
47951         this_arg_conv.inner = untag_ptr(this_arg);
47952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47954         this_arg_conv.is_owned = false;
47955         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
47956 }
47957
47958 jboolean  __attribute__((export_name("TS_InitFeatures_supports_data_loss_protect"))) TS_InitFeatures_supports_data_loss_protect(uint64_t this_arg) {
47959         LDKInitFeatures this_arg_conv;
47960         this_arg_conv.inner = untag_ptr(this_arg);
47961         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47962         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47963         this_arg_conv.is_owned = false;
47964         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
47965         return ret_conv;
47966 }
47967
47968 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_optional"))) TS_NodeFeatures_set_data_loss_protect_optional(uint64_t this_arg) {
47969         LDKNodeFeatures this_arg_conv;
47970         this_arg_conv.inner = untag_ptr(this_arg);
47971         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47972         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47973         this_arg_conv.is_owned = false;
47974         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
47975 }
47976
47977 void  __attribute__((export_name("TS_NodeFeatures_set_data_loss_protect_required"))) TS_NodeFeatures_set_data_loss_protect_required(uint64_t this_arg) {
47978         LDKNodeFeatures this_arg_conv;
47979         this_arg_conv.inner = untag_ptr(this_arg);
47980         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47982         this_arg_conv.is_owned = false;
47983         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
47984 }
47985
47986 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_data_loss_protect"))) TS_NodeFeatures_supports_data_loss_protect(uint64_t this_arg) {
47987         LDKNodeFeatures this_arg_conv;
47988         this_arg_conv.inner = untag_ptr(this_arg);
47989         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47991         this_arg_conv.is_owned = false;
47992         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
47993         return ret_conv;
47994 }
47995
47996 jboolean  __attribute__((export_name("TS_InitFeatures_requires_data_loss_protect"))) TS_InitFeatures_requires_data_loss_protect(uint64_t this_arg) {
47997         LDKInitFeatures this_arg_conv;
47998         this_arg_conv.inner = untag_ptr(this_arg);
47999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48001         this_arg_conv.is_owned = false;
48002         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
48003         return ret_conv;
48004 }
48005
48006 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_data_loss_protect"))) TS_NodeFeatures_requires_data_loss_protect(uint64_t this_arg) {
48007         LDKNodeFeatures this_arg_conv;
48008         this_arg_conv.inner = untag_ptr(this_arg);
48009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48011         this_arg_conv.is_owned = false;
48012         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
48013         return ret_conv;
48014 }
48015
48016 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_optional"))) TS_InitFeatures_set_initial_routing_sync_optional(uint64_t this_arg) {
48017         LDKInitFeatures this_arg_conv;
48018         this_arg_conv.inner = untag_ptr(this_arg);
48019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48021         this_arg_conv.is_owned = false;
48022         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
48023 }
48024
48025 void  __attribute__((export_name("TS_InitFeatures_set_initial_routing_sync_required"))) TS_InitFeatures_set_initial_routing_sync_required(uint64_t this_arg) {
48026         LDKInitFeatures this_arg_conv;
48027         this_arg_conv.inner = untag_ptr(this_arg);
48028         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48030         this_arg_conv.is_owned = false;
48031         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
48032 }
48033
48034 jboolean  __attribute__((export_name("TS_InitFeatures_initial_routing_sync"))) TS_InitFeatures_initial_routing_sync(uint64_t this_arg) {
48035         LDKInitFeatures this_arg_conv;
48036         this_arg_conv.inner = untag_ptr(this_arg);
48037         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48039         this_arg_conv.is_owned = false;
48040         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
48041         return ret_conv;
48042 }
48043
48044 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_optional"))) TS_InitFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
48045         LDKInitFeatures this_arg_conv;
48046         this_arg_conv.inner = untag_ptr(this_arg);
48047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48049         this_arg_conv.is_owned = false;
48050         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
48051 }
48052
48053 void  __attribute__((export_name("TS_InitFeatures_set_upfront_shutdown_script_required"))) TS_InitFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
48054         LDKInitFeatures this_arg_conv;
48055         this_arg_conv.inner = untag_ptr(this_arg);
48056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48058         this_arg_conv.is_owned = false;
48059         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
48060 }
48061
48062 jboolean  __attribute__((export_name("TS_InitFeatures_supports_upfront_shutdown_script"))) TS_InitFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
48063         LDKInitFeatures this_arg_conv;
48064         this_arg_conv.inner = untag_ptr(this_arg);
48065         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48066         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48067         this_arg_conv.is_owned = false;
48068         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
48069         return ret_conv;
48070 }
48071
48072 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_optional"))) TS_NodeFeatures_set_upfront_shutdown_script_optional(uint64_t this_arg) {
48073         LDKNodeFeatures this_arg_conv;
48074         this_arg_conv.inner = untag_ptr(this_arg);
48075         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48077         this_arg_conv.is_owned = false;
48078         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
48079 }
48080
48081 void  __attribute__((export_name("TS_NodeFeatures_set_upfront_shutdown_script_required"))) TS_NodeFeatures_set_upfront_shutdown_script_required(uint64_t this_arg) {
48082         LDKNodeFeatures this_arg_conv;
48083         this_arg_conv.inner = untag_ptr(this_arg);
48084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48086         this_arg_conv.is_owned = false;
48087         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
48088 }
48089
48090 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_upfront_shutdown_script"))) TS_NodeFeatures_supports_upfront_shutdown_script(uint64_t this_arg) {
48091         LDKNodeFeatures this_arg_conv;
48092         this_arg_conv.inner = untag_ptr(this_arg);
48093         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48095         this_arg_conv.is_owned = false;
48096         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
48097         return ret_conv;
48098 }
48099
48100 jboolean  __attribute__((export_name("TS_InitFeatures_requires_upfront_shutdown_script"))) TS_InitFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
48101         LDKInitFeatures this_arg_conv;
48102         this_arg_conv.inner = untag_ptr(this_arg);
48103         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48104         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48105         this_arg_conv.is_owned = false;
48106         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
48107         return ret_conv;
48108 }
48109
48110 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_upfront_shutdown_script"))) TS_NodeFeatures_requires_upfront_shutdown_script(uint64_t this_arg) {
48111         LDKNodeFeatures this_arg_conv;
48112         this_arg_conv.inner = untag_ptr(this_arg);
48113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48115         this_arg_conv.is_owned = false;
48116         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
48117         return ret_conv;
48118 }
48119
48120 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_optional"))) TS_InitFeatures_set_gossip_queries_optional(uint64_t this_arg) {
48121         LDKInitFeatures this_arg_conv;
48122         this_arg_conv.inner = untag_ptr(this_arg);
48123         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48125         this_arg_conv.is_owned = false;
48126         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
48127 }
48128
48129 void  __attribute__((export_name("TS_InitFeatures_set_gossip_queries_required"))) TS_InitFeatures_set_gossip_queries_required(uint64_t this_arg) {
48130         LDKInitFeatures this_arg_conv;
48131         this_arg_conv.inner = untag_ptr(this_arg);
48132         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48134         this_arg_conv.is_owned = false;
48135         InitFeatures_set_gossip_queries_required(&this_arg_conv);
48136 }
48137
48138 jboolean  __attribute__((export_name("TS_InitFeatures_supports_gossip_queries"))) TS_InitFeatures_supports_gossip_queries(uint64_t this_arg) {
48139         LDKInitFeatures this_arg_conv;
48140         this_arg_conv.inner = untag_ptr(this_arg);
48141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48143         this_arg_conv.is_owned = false;
48144         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
48145         return ret_conv;
48146 }
48147
48148 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_optional"))) TS_NodeFeatures_set_gossip_queries_optional(uint64_t this_arg) {
48149         LDKNodeFeatures this_arg_conv;
48150         this_arg_conv.inner = untag_ptr(this_arg);
48151         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48153         this_arg_conv.is_owned = false;
48154         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
48155 }
48156
48157 void  __attribute__((export_name("TS_NodeFeatures_set_gossip_queries_required"))) TS_NodeFeatures_set_gossip_queries_required(uint64_t this_arg) {
48158         LDKNodeFeatures this_arg_conv;
48159         this_arg_conv.inner = untag_ptr(this_arg);
48160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48162         this_arg_conv.is_owned = false;
48163         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
48164 }
48165
48166 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_gossip_queries"))) TS_NodeFeatures_supports_gossip_queries(uint64_t this_arg) {
48167         LDKNodeFeatures this_arg_conv;
48168         this_arg_conv.inner = untag_ptr(this_arg);
48169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48171         this_arg_conv.is_owned = false;
48172         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
48173         return ret_conv;
48174 }
48175
48176 jboolean  __attribute__((export_name("TS_InitFeatures_requires_gossip_queries"))) TS_InitFeatures_requires_gossip_queries(uint64_t this_arg) {
48177         LDKInitFeatures this_arg_conv;
48178         this_arg_conv.inner = untag_ptr(this_arg);
48179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48181         this_arg_conv.is_owned = false;
48182         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
48183         return ret_conv;
48184 }
48185
48186 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_gossip_queries"))) TS_NodeFeatures_requires_gossip_queries(uint64_t this_arg) {
48187         LDKNodeFeatures this_arg_conv;
48188         this_arg_conv.inner = untag_ptr(this_arg);
48189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48191         this_arg_conv.is_owned = false;
48192         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
48193         return ret_conv;
48194 }
48195
48196 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_optional"))) TS_InitFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
48197         LDKInitFeatures this_arg_conv;
48198         this_arg_conv.inner = untag_ptr(this_arg);
48199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48201         this_arg_conv.is_owned = false;
48202         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
48203 }
48204
48205 void  __attribute__((export_name("TS_InitFeatures_set_variable_length_onion_required"))) TS_InitFeatures_set_variable_length_onion_required(uint64_t this_arg) {
48206         LDKInitFeatures this_arg_conv;
48207         this_arg_conv.inner = untag_ptr(this_arg);
48208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48210         this_arg_conv.is_owned = false;
48211         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
48212 }
48213
48214 jboolean  __attribute__((export_name("TS_InitFeatures_supports_variable_length_onion"))) TS_InitFeatures_supports_variable_length_onion(uint64_t this_arg) {
48215         LDKInitFeatures this_arg_conv;
48216         this_arg_conv.inner = untag_ptr(this_arg);
48217         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48219         this_arg_conv.is_owned = false;
48220         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
48221         return ret_conv;
48222 }
48223
48224 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_optional"))) TS_NodeFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
48225         LDKNodeFeatures 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         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
48231 }
48232
48233 void  __attribute__((export_name("TS_NodeFeatures_set_variable_length_onion_required"))) TS_NodeFeatures_set_variable_length_onion_required(uint64_t this_arg) {
48234         LDKNodeFeatures this_arg_conv;
48235         this_arg_conv.inner = untag_ptr(this_arg);
48236         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48238         this_arg_conv.is_owned = false;
48239         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
48240 }
48241
48242 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_variable_length_onion"))) TS_NodeFeatures_supports_variable_length_onion(uint64_t this_arg) {
48243         LDKNodeFeatures this_arg_conv;
48244         this_arg_conv.inner = untag_ptr(this_arg);
48245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48247         this_arg_conv.is_owned = false;
48248         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
48249         return ret_conv;
48250 }
48251
48252 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_optional(uint64_t this_arg) {
48253         LDKBolt11InvoiceFeatures this_arg_conv;
48254         this_arg_conv.inner = untag_ptr(this_arg);
48255         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48257         this_arg_conv.is_owned = false;
48258         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
48259 }
48260
48261 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_variable_length_onion_required"))) TS_Bolt11InvoiceFeatures_set_variable_length_onion_required(uint64_t this_arg) {
48262         LDKBolt11InvoiceFeatures this_arg_conv;
48263         this_arg_conv.inner = untag_ptr(this_arg);
48264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48266         this_arg_conv.is_owned = false;
48267         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
48268 }
48269
48270 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_variable_length_onion"))) TS_Bolt11InvoiceFeatures_supports_variable_length_onion(uint64_t this_arg) {
48271         LDKBolt11InvoiceFeatures this_arg_conv;
48272         this_arg_conv.inner = untag_ptr(this_arg);
48273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48275         this_arg_conv.is_owned = false;
48276         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
48277         return ret_conv;
48278 }
48279
48280 jboolean  __attribute__((export_name("TS_InitFeatures_requires_variable_length_onion"))) TS_InitFeatures_requires_variable_length_onion(uint64_t this_arg) {
48281         LDKInitFeatures this_arg_conv;
48282         this_arg_conv.inner = untag_ptr(this_arg);
48283         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48285         this_arg_conv.is_owned = false;
48286         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
48287         return ret_conv;
48288 }
48289
48290 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_variable_length_onion"))) TS_NodeFeatures_requires_variable_length_onion(uint64_t this_arg) {
48291         LDKNodeFeatures this_arg_conv;
48292         this_arg_conv.inner = untag_ptr(this_arg);
48293         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48295         this_arg_conv.is_owned = false;
48296         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
48297         return ret_conv;
48298 }
48299
48300 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_variable_length_onion"))) TS_Bolt11InvoiceFeatures_requires_variable_length_onion(uint64_t this_arg) {
48301         LDKBolt11InvoiceFeatures this_arg_conv;
48302         this_arg_conv.inner = untag_ptr(this_arg);
48303         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48305         this_arg_conv.is_owned = false;
48306         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
48307         return ret_conv;
48308 }
48309
48310 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_optional"))) TS_InitFeatures_set_static_remote_key_optional(uint64_t this_arg) {
48311         LDKInitFeatures this_arg_conv;
48312         this_arg_conv.inner = untag_ptr(this_arg);
48313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48315         this_arg_conv.is_owned = false;
48316         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
48317 }
48318
48319 void  __attribute__((export_name("TS_InitFeatures_set_static_remote_key_required"))) TS_InitFeatures_set_static_remote_key_required(uint64_t this_arg) {
48320         LDKInitFeatures this_arg_conv;
48321         this_arg_conv.inner = untag_ptr(this_arg);
48322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48324         this_arg_conv.is_owned = false;
48325         InitFeatures_set_static_remote_key_required(&this_arg_conv);
48326 }
48327
48328 jboolean  __attribute__((export_name("TS_InitFeatures_supports_static_remote_key"))) TS_InitFeatures_supports_static_remote_key(uint64_t this_arg) {
48329         LDKInitFeatures this_arg_conv;
48330         this_arg_conv.inner = untag_ptr(this_arg);
48331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48333         this_arg_conv.is_owned = false;
48334         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
48335         return ret_conv;
48336 }
48337
48338 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_optional"))) TS_NodeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
48339         LDKNodeFeatures this_arg_conv;
48340         this_arg_conv.inner = untag_ptr(this_arg);
48341         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48343         this_arg_conv.is_owned = false;
48344         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
48345 }
48346
48347 void  __attribute__((export_name("TS_NodeFeatures_set_static_remote_key_required"))) TS_NodeFeatures_set_static_remote_key_required(uint64_t this_arg) {
48348         LDKNodeFeatures this_arg_conv;
48349         this_arg_conv.inner = untag_ptr(this_arg);
48350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48352         this_arg_conv.is_owned = false;
48353         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
48354 }
48355
48356 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_static_remote_key"))) TS_NodeFeatures_supports_static_remote_key(uint64_t this_arg) {
48357         LDKNodeFeatures this_arg_conv;
48358         this_arg_conv.inner = untag_ptr(this_arg);
48359         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48361         this_arg_conv.is_owned = false;
48362         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
48363         return ret_conv;
48364 }
48365
48366 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_optional"))) TS_ChannelTypeFeatures_set_static_remote_key_optional(uint64_t this_arg) {
48367         LDKChannelTypeFeatures this_arg_conv;
48368         this_arg_conv.inner = untag_ptr(this_arg);
48369         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48371         this_arg_conv.is_owned = false;
48372         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
48373 }
48374
48375 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_static_remote_key_required"))) TS_ChannelTypeFeatures_set_static_remote_key_required(uint64_t this_arg) {
48376         LDKChannelTypeFeatures this_arg_conv;
48377         this_arg_conv.inner = untag_ptr(this_arg);
48378         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48379         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48380         this_arg_conv.is_owned = false;
48381         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
48382 }
48383
48384 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_static_remote_key"))) TS_ChannelTypeFeatures_supports_static_remote_key(uint64_t this_arg) {
48385         LDKChannelTypeFeatures this_arg_conv;
48386         this_arg_conv.inner = untag_ptr(this_arg);
48387         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48389         this_arg_conv.is_owned = false;
48390         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
48391         return ret_conv;
48392 }
48393
48394 jboolean  __attribute__((export_name("TS_InitFeatures_requires_static_remote_key"))) TS_InitFeatures_requires_static_remote_key(uint64_t this_arg) {
48395         LDKInitFeatures this_arg_conv;
48396         this_arg_conv.inner = untag_ptr(this_arg);
48397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48399         this_arg_conv.is_owned = false;
48400         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
48401         return ret_conv;
48402 }
48403
48404 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_static_remote_key"))) TS_NodeFeatures_requires_static_remote_key(uint64_t this_arg) {
48405         LDKNodeFeatures this_arg_conv;
48406         this_arg_conv.inner = untag_ptr(this_arg);
48407         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48409         this_arg_conv.is_owned = false;
48410         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
48411         return ret_conv;
48412 }
48413
48414 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_static_remote_key"))) TS_ChannelTypeFeatures_requires_static_remote_key(uint64_t this_arg) {
48415         LDKChannelTypeFeatures this_arg_conv;
48416         this_arg_conv.inner = untag_ptr(this_arg);
48417         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48419         this_arg_conv.is_owned = false;
48420         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
48421         return ret_conv;
48422 }
48423
48424 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_optional"))) TS_InitFeatures_set_payment_secret_optional(uint64_t this_arg) {
48425         LDKInitFeatures this_arg_conv;
48426         this_arg_conv.inner = untag_ptr(this_arg);
48427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48429         this_arg_conv.is_owned = false;
48430         InitFeatures_set_payment_secret_optional(&this_arg_conv);
48431 }
48432
48433 void  __attribute__((export_name("TS_InitFeatures_set_payment_secret_required"))) TS_InitFeatures_set_payment_secret_required(uint64_t this_arg) {
48434         LDKInitFeatures this_arg_conv;
48435         this_arg_conv.inner = untag_ptr(this_arg);
48436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48438         this_arg_conv.is_owned = false;
48439         InitFeatures_set_payment_secret_required(&this_arg_conv);
48440 }
48441
48442 jboolean  __attribute__((export_name("TS_InitFeatures_supports_payment_secret"))) TS_InitFeatures_supports_payment_secret(uint64_t this_arg) {
48443         LDKInitFeatures this_arg_conv;
48444         this_arg_conv.inner = untag_ptr(this_arg);
48445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48447         this_arg_conv.is_owned = false;
48448         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
48449         return ret_conv;
48450 }
48451
48452 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_optional"))) TS_NodeFeatures_set_payment_secret_optional(uint64_t this_arg) {
48453         LDKNodeFeatures this_arg_conv;
48454         this_arg_conv.inner = untag_ptr(this_arg);
48455         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48457         this_arg_conv.is_owned = false;
48458         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
48459 }
48460
48461 void  __attribute__((export_name("TS_NodeFeatures_set_payment_secret_required"))) TS_NodeFeatures_set_payment_secret_required(uint64_t this_arg) {
48462         LDKNodeFeatures this_arg_conv;
48463         this_arg_conv.inner = untag_ptr(this_arg);
48464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48466         this_arg_conv.is_owned = false;
48467         NodeFeatures_set_payment_secret_required(&this_arg_conv);
48468 }
48469
48470 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_payment_secret"))) TS_NodeFeatures_supports_payment_secret(uint64_t this_arg) {
48471         LDKNodeFeatures this_arg_conv;
48472         this_arg_conv.inner = untag_ptr(this_arg);
48473         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48474         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48475         this_arg_conv.is_owned = false;
48476         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
48477         return ret_conv;
48478 }
48479
48480 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_optional"))) TS_Bolt11InvoiceFeatures_set_payment_secret_optional(uint64_t this_arg) {
48481         LDKBolt11InvoiceFeatures this_arg_conv;
48482         this_arg_conv.inner = untag_ptr(this_arg);
48483         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48485         this_arg_conv.is_owned = false;
48486         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
48487 }
48488
48489 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_secret_required"))) TS_Bolt11InvoiceFeatures_set_payment_secret_required(uint64_t this_arg) {
48490         LDKBolt11InvoiceFeatures this_arg_conv;
48491         this_arg_conv.inner = untag_ptr(this_arg);
48492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48494         this_arg_conv.is_owned = false;
48495         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
48496 }
48497
48498 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_secret"))) TS_Bolt11InvoiceFeatures_supports_payment_secret(uint64_t this_arg) {
48499         LDKBolt11InvoiceFeatures this_arg_conv;
48500         this_arg_conv.inner = untag_ptr(this_arg);
48501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48503         this_arg_conv.is_owned = false;
48504         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
48505         return ret_conv;
48506 }
48507
48508 jboolean  __attribute__((export_name("TS_InitFeatures_requires_payment_secret"))) TS_InitFeatures_requires_payment_secret(uint64_t this_arg) {
48509         LDKInitFeatures this_arg_conv;
48510         this_arg_conv.inner = untag_ptr(this_arg);
48511         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48513         this_arg_conv.is_owned = false;
48514         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
48515         return ret_conv;
48516 }
48517
48518 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_payment_secret"))) TS_NodeFeatures_requires_payment_secret(uint64_t this_arg) {
48519         LDKNodeFeatures this_arg_conv;
48520         this_arg_conv.inner = untag_ptr(this_arg);
48521         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48523         this_arg_conv.is_owned = false;
48524         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
48525         return ret_conv;
48526 }
48527
48528 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_secret"))) TS_Bolt11InvoiceFeatures_requires_payment_secret(uint64_t this_arg) {
48529         LDKBolt11InvoiceFeatures this_arg_conv;
48530         this_arg_conv.inner = untag_ptr(this_arg);
48531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48533         this_arg_conv.is_owned = false;
48534         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
48535         return ret_conv;
48536 }
48537
48538 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_optional"))) TS_InitFeatures_set_basic_mpp_optional(uint64_t this_arg) {
48539         LDKInitFeatures this_arg_conv;
48540         this_arg_conv.inner = untag_ptr(this_arg);
48541         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48543         this_arg_conv.is_owned = false;
48544         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
48545 }
48546
48547 void  __attribute__((export_name("TS_InitFeatures_set_basic_mpp_required"))) TS_InitFeatures_set_basic_mpp_required(uint64_t this_arg) {
48548         LDKInitFeatures this_arg_conv;
48549         this_arg_conv.inner = untag_ptr(this_arg);
48550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48552         this_arg_conv.is_owned = false;
48553         InitFeatures_set_basic_mpp_required(&this_arg_conv);
48554 }
48555
48556 jboolean  __attribute__((export_name("TS_InitFeatures_supports_basic_mpp"))) TS_InitFeatures_supports_basic_mpp(uint64_t this_arg) {
48557         LDKInitFeatures this_arg_conv;
48558         this_arg_conv.inner = untag_ptr(this_arg);
48559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48561         this_arg_conv.is_owned = false;
48562         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
48563         return ret_conv;
48564 }
48565
48566 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_optional"))) TS_NodeFeatures_set_basic_mpp_optional(uint64_t this_arg) {
48567         LDKNodeFeatures this_arg_conv;
48568         this_arg_conv.inner = untag_ptr(this_arg);
48569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48571         this_arg_conv.is_owned = false;
48572         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
48573 }
48574
48575 void  __attribute__((export_name("TS_NodeFeatures_set_basic_mpp_required"))) TS_NodeFeatures_set_basic_mpp_required(uint64_t this_arg) {
48576         LDKNodeFeatures this_arg_conv;
48577         this_arg_conv.inner = untag_ptr(this_arg);
48578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48580         this_arg_conv.is_owned = false;
48581         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
48582 }
48583
48584 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_basic_mpp"))) TS_NodeFeatures_supports_basic_mpp(uint64_t this_arg) {
48585         LDKNodeFeatures this_arg_conv;
48586         this_arg_conv.inner = untag_ptr(this_arg);
48587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48589         this_arg_conv.is_owned = false;
48590         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
48591         return ret_conv;
48592 }
48593
48594 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
48595         LDKBolt11InvoiceFeatures this_arg_conv;
48596         this_arg_conv.inner = untag_ptr(this_arg);
48597         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48599         this_arg_conv.is_owned = false;
48600         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
48601 }
48602
48603 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt11InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
48604         LDKBolt11InvoiceFeatures this_arg_conv;
48605         this_arg_conv.inner = untag_ptr(this_arg);
48606         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48608         this_arg_conv.is_owned = false;
48609         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
48610 }
48611
48612 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_basic_mpp"))) TS_Bolt11InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
48613         LDKBolt11InvoiceFeatures this_arg_conv;
48614         this_arg_conv.inner = untag_ptr(this_arg);
48615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48617         this_arg_conv.is_owned = false;
48618         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
48619         return ret_conv;
48620 }
48621
48622 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) {
48623         LDKBolt12InvoiceFeatures this_arg_conv;
48624         this_arg_conv.inner = untag_ptr(this_arg);
48625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48627         this_arg_conv.is_owned = false;
48628         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
48629 }
48630
48631 void  __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) {
48632         LDKBolt12InvoiceFeatures this_arg_conv;
48633         this_arg_conv.inner = untag_ptr(this_arg);
48634         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48635         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48636         this_arg_conv.is_owned = false;
48637         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
48638 }
48639
48640 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) {
48641         LDKBolt12InvoiceFeatures this_arg_conv;
48642         this_arg_conv.inner = untag_ptr(this_arg);
48643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48645         this_arg_conv.is_owned = false;
48646         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
48647         return ret_conv;
48648 }
48649
48650 jboolean  __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) {
48651         LDKInitFeatures this_arg_conv;
48652         this_arg_conv.inner = untag_ptr(this_arg);
48653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48655         this_arg_conv.is_owned = false;
48656         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
48657         return ret_conv;
48658 }
48659
48660 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_basic_mpp"))) TS_NodeFeatures_requires_basic_mpp(uint64_t this_arg) {
48661         LDKNodeFeatures this_arg_conv;
48662         this_arg_conv.inner = untag_ptr(this_arg);
48663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48665         this_arg_conv.is_owned = false;
48666         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
48667         return ret_conv;
48668 }
48669
48670 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_basic_mpp"))) TS_Bolt11InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
48671         LDKBolt11InvoiceFeatures this_arg_conv;
48672         this_arg_conv.inner = untag_ptr(this_arg);
48673         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48674         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48675         this_arg_conv.is_owned = false;
48676         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
48677         return ret_conv;
48678 }
48679
48680 jboolean  __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) {
48681         LDKBolt12InvoiceFeatures this_arg_conv;
48682         this_arg_conv.inner = untag_ptr(this_arg);
48683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48685         this_arg_conv.is_owned = false;
48686         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
48687         return ret_conv;
48688 }
48689
48690 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) {
48691         LDKInitFeatures this_arg_conv;
48692         this_arg_conv.inner = untag_ptr(this_arg);
48693         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48695         this_arg_conv.is_owned = false;
48696         InitFeatures_set_wumbo_optional(&this_arg_conv);
48697 }
48698
48699 void  __attribute__((export_name("TS_InitFeatures_set_wumbo_required"))) TS_InitFeatures_set_wumbo_required(uint64_t this_arg) {
48700         LDKInitFeatures this_arg_conv;
48701         this_arg_conv.inner = untag_ptr(this_arg);
48702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48704         this_arg_conv.is_owned = false;
48705         InitFeatures_set_wumbo_required(&this_arg_conv);
48706 }
48707
48708 jboolean  __attribute__((export_name("TS_InitFeatures_supports_wumbo"))) TS_InitFeatures_supports_wumbo(uint64_t this_arg) {
48709         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
48715         return ret_conv;
48716 }
48717
48718 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_optional"))) TS_NodeFeatures_set_wumbo_optional(uint64_t this_arg) {
48719         LDKNodeFeatures 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         NodeFeatures_set_wumbo_optional(&this_arg_conv);
48725 }
48726
48727 void  __attribute__((export_name("TS_NodeFeatures_set_wumbo_required"))) TS_NodeFeatures_set_wumbo_required(uint64_t this_arg) {
48728         LDKNodeFeatures this_arg_conv;
48729         this_arg_conv.inner = untag_ptr(this_arg);
48730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48732         this_arg_conv.is_owned = false;
48733         NodeFeatures_set_wumbo_required(&this_arg_conv);
48734 }
48735
48736 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_wumbo"))) TS_NodeFeatures_supports_wumbo(uint64_t this_arg) {
48737         LDKNodeFeatures this_arg_conv;
48738         this_arg_conv.inner = untag_ptr(this_arg);
48739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48741         this_arg_conv.is_owned = false;
48742         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
48743         return ret_conv;
48744 }
48745
48746 jboolean  __attribute__((export_name("TS_InitFeatures_requires_wumbo"))) TS_InitFeatures_requires_wumbo(uint64_t this_arg) {
48747         LDKInitFeatures this_arg_conv;
48748         this_arg_conv.inner = untag_ptr(this_arg);
48749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48751         this_arg_conv.is_owned = false;
48752         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
48753         return ret_conv;
48754 }
48755
48756 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_NodeFeatures_requires_wumbo(uint64_t this_arg) {
48757         LDKNodeFeatures this_arg_conv;
48758         this_arg_conv.inner = untag_ptr(this_arg);
48759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48761         this_arg_conv.is_owned = false;
48762         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
48763         return ret_conv;
48764 }
48765
48766 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) {
48767         LDKInitFeatures this_arg_conv;
48768         this_arg_conv.inner = untag_ptr(this_arg);
48769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48771         this_arg_conv.is_owned = false;
48772         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
48773 }
48774
48775 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) {
48776         LDKInitFeatures this_arg_conv;
48777         this_arg_conv.inner = untag_ptr(this_arg);
48778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48780         this_arg_conv.is_owned = false;
48781         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
48782 }
48783
48784 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48785         LDKInitFeatures this_arg_conv;
48786         this_arg_conv.inner = untag_ptr(this_arg);
48787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48789         this_arg_conv.is_owned = false;
48790         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48791         return ret_conv;
48792 }
48793
48794 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) {
48795         LDKNodeFeatures this_arg_conv;
48796         this_arg_conv.inner = untag_ptr(this_arg);
48797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48799         this_arg_conv.is_owned = false;
48800         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
48801 }
48802
48803 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) {
48804         LDKNodeFeatures this_arg_conv;
48805         this_arg_conv.inner = untag_ptr(this_arg);
48806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48808         this_arg_conv.is_owned = false;
48809         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
48810 }
48811
48812 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48813         LDKNodeFeatures this_arg_conv;
48814         this_arg_conv.inner = untag_ptr(this_arg);
48815         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48816         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48817         this_arg_conv.is_owned = false;
48818         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48819         return ret_conv;
48820 }
48821
48822 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) {
48823         LDKChannelTypeFeatures this_arg_conv;
48824         this_arg_conv.inner = untag_ptr(this_arg);
48825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48827         this_arg_conv.is_owned = false;
48828         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
48829 }
48830
48831 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) {
48832         LDKChannelTypeFeatures this_arg_conv;
48833         this_arg_conv.inner = untag_ptr(this_arg);
48834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48836         this_arg_conv.is_owned = false;
48837         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
48838 }
48839
48840 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48841         LDKChannelTypeFeatures this_arg_conv;
48842         this_arg_conv.inner = untag_ptr(this_arg);
48843         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48845         this_arg_conv.is_owned = false;
48846         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48847         return ret_conv;
48848 }
48849
48850 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48851         LDKInitFeatures this_arg_conv;
48852         this_arg_conv.inner = untag_ptr(this_arg);
48853         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48855         this_arg_conv.is_owned = false;
48856         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48857         return ret_conv;
48858 }
48859
48860 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48861         LDKNodeFeatures this_arg_conv;
48862         this_arg_conv.inner = untag_ptr(this_arg);
48863         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48865         this_arg_conv.is_owned = false;
48866         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48867         return ret_conv;
48868 }
48869
48870 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(uint64_t this_arg) {
48871         LDKChannelTypeFeatures this_arg_conv;
48872         this_arg_conv.inner = untag_ptr(this_arg);
48873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48875         this_arg_conv.is_owned = false;
48876         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
48877         return ret_conv;
48878 }
48879
48880 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) {
48881         LDKInitFeatures this_arg_conv;
48882         this_arg_conv.inner = untag_ptr(this_arg);
48883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48885         this_arg_conv.is_owned = false;
48886         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
48887 }
48888
48889 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) {
48890         LDKInitFeatures this_arg_conv;
48891         this_arg_conv.inner = untag_ptr(this_arg);
48892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48894         this_arg_conv.is_owned = false;
48895         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
48896 }
48897
48898 jboolean  __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48899         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
48905         return ret_conv;
48906 }
48907
48908 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) {
48909         LDKNodeFeatures this_arg_conv;
48910         this_arg_conv.inner = untag_ptr(this_arg);
48911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48913         this_arg_conv.is_owned = false;
48914         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
48915 }
48916
48917 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) {
48918         LDKNodeFeatures this_arg_conv;
48919         this_arg_conv.inner = untag_ptr(this_arg);
48920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48922         this_arg_conv.is_owned = false;
48923         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
48924 }
48925
48926 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48927         LDKNodeFeatures this_arg_conv;
48928         this_arg_conv.inner = untag_ptr(this_arg);
48929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48931         this_arg_conv.is_owned = false;
48932         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
48933         return ret_conv;
48934 }
48935
48936 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) {
48937         LDKChannelTypeFeatures this_arg_conv;
48938         this_arg_conv.inner = untag_ptr(this_arg);
48939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48941         this_arg_conv.is_owned = false;
48942         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
48943 }
48944
48945 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) {
48946         LDKChannelTypeFeatures 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         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
48952 }
48953
48954 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48955         LDKChannelTypeFeatures this_arg_conv;
48956         this_arg_conv.inner = untag_ptr(this_arg);
48957         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48958         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48959         this_arg_conv.is_owned = false;
48960         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
48961         return ret_conv;
48962 }
48963
48964 jboolean  __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48965         LDKInitFeatures this_arg_conv;
48966         this_arg_conv.inner = untag_ptr(this_arg);
48967         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48968         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48969         this_arg_conv.is_owned = false;
48970         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
48971         return ret_conv;
48972 }
48973
48974 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48975         LDKNodeFeatures this_arg_conv;
48976         this_arg_conv.inner = untag_ptr(this_arg);
48977         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48979         this_arg_conv.is_owned = false;
48980         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
48981         return ret_conv;
48982 }
48983
48984 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) {
48985         LDKChannelTypeFeatures this_arg_conv;
48986         this_arg_conv.inner = untag_ptr(this_arg);
48987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48989         this_arg_conv.is_owned = false;
48990         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
48991         return ret_conv;
48992 }
48993
48994 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
48995         LDKInitFeatures this_arg_conv;
48996         this_arg_conv.inner = untag_ptr(this_arg);
48997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48999         this_arg_conv.is_owned = false;
49000         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
49001 }
49002
49003 void  __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_required"))) TS_InitFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
49004         LDKInitFeatures this_arg_conv;
49005         this_arg_conv.inner = untag_ptr(this_arg);
49006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49008         this_arg_conv.is_owned = false;
49009         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
49010 }
49011
49012 jboolean  __attribute__((export_name("TS_InitFeatures_supports_shutdown_anysegwit"))) TS_InitFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
49013         LDKInitFeatures this_arg_conv;
49014         this_arg_conv.inner = untag_ptr(this_arg);
49015         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49017         this_arg_conv.is_owned = false;
49018         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
49019         return ret_conv;
49020 }
49021
49022 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_optional"))) TS_NodeFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) {
49023         LDKNodeFeatures this_arg_conv;
49024         this_arg_conv.inner = untag_ptr(this_arg);
49025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49027         this_arg_conv.is_owned = false;
49028         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
49029 }
49030
49031 void  __attribute__((export_name("TS_NodeFeatures_set_shutdown_any_segwit_required"))) TS_NodeFeatures_set_shutdown_any_segwit_required(uint64_t this_arg) {
49032         LDKNodeFeatures this_arg_conv;
49033         this_arg_conv.inner = untag_ptr(this_arg);
49034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49036         this_arg_conv.is_owned = false;
49037         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
49038 }
49039
49040 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_shutdown_anysegwit"))) TS_NodeFeatures_supports_shutdown_anysegwit(uint64_t this_arg) {
49041         LDKNodeFeatures this_arg_conv;
49042         this_arg_conv.inner = untag_ptr(this_arg);
49043         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49044         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49045         this_arg_conv.is_owned = false;
49046         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
49047         return ret_conv;
49048 }
49049
49050 jboolean  __attribute__((export_name("TS_InitFeatures_requires_shutdown_anysegwit"))) TS_InitFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
49051         LDKInitFeatures this_arg_conv;
49052         this_arg_conv.inner = untag_ptr(this_arg);
49053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49055         this_arg_conv.is_owned = false;
49056         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
49057         return ret_conv;
49058 }
49059
49060 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_shutdown_anysegwit"))) TS_NodeFeatures_requires_shutdown_anysegwit(uint64_t this_arg) {
49061         LDKNodeFeatures this_arg_conv;
49062         this_arg_conv.inner = untag_ptr(this_arg);
49063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49065         this_arg_conv.is_owned = false;
49066         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
49067         return ret_conv;
49068 }
49069
49070 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_optional"))) TS_InitFeatures_set_onion_messages_optional(uint64_t this_arg) {
49071         LDKInitFeatures this_arg_conv;
49072         this_arg_conv.inner = untag_ptr(this_arg);
49073         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49075         this_arg_conv.is_owned = false;
49076         InitFeatures_set_onion_messages_optional(&this_arg_conv);
49077 }
49078
49079 void  __attribute__((export_name("TS_InitFeatures_set_onion_messages_required"))) TS_InitFeatures_set_onion_messages_required(uint64_t this_arg) {
49080         LDKInitFeatures this_arg_conv;
49081         this_arg_conv.inner = untag_ptr(this_arg);
49082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49084         this_arg_conv.is_owned = false;
49085         InitFeatures_set_onion_messages_required(&this_arg_conv);
49086 }
49087
49088 jboolean  __attribute__((export_name("TS_InitFeatures_supports_onion_messages"))) TS_InitFeatures_supports_onion_messages(uint64_t this_arg) {
49089         LDKInitFeatures this_arg_conv;
49090         this_arg_conv.inner = untag_ptr(this_arg);
49091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49093         this_arg_conv.is_owned = false;
49094         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
49095         return ret_conv;
49096 }
49097
49098 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_optional"))) TS_NodeFeatures_set_onion_messages_optional(uint64_t this_arg) {
49099         LDKNodeFeatures this_arg_conv;
49100         this_arg_conv.inner = untag_ptr(this_arg);
49101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49103         this_arg_conv.is_owned = false;
49104         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
49105 }
49106
49107 void  __attribute__((export_name("TS_NodeFeatures_set_onion_messages_required"))) TS_NodeFeatures_set_onion_messages_required(uint64_t this_arg) {
49108         LDKNodeFeatures this_arg_conv;
49109         this_arg_conv.inner = untag_ptr(this_arg);
49110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49112         this_arg_conv.is_owned = false;
49113         NodeFeatures_set_onion_messages_required(&this_arg_conv);
49114 }
49115
49116 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_onion_messages"))) TS_NodeFeatures_supports_onion_messages(uint64_t this_arg) {
49117         LDKNodeFeatures this_arg_conv;
49118         this_arg_conv.inner = untag_ptr(this_arg);
49119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49121         this_arg_conv.is_owned = false;
49122         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
49123         return ret_conv;
49124 }
49125
49126 jboolean  __attribute__((export_name("TS_InitFeatures_requires_onion_messages"))) TS_InitFeatures_requires_onion_messages(uint64_t this_arg) {
49127         LDKInitFeatures this_arg_conv;
49128         this_arg_conv.inner = untag_ptr(this_arg);
49129         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49131         this_arg_conv.is_owned = false;
49132         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
49133         return ret_conv;
49134 }
49135
49136 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_onion_messages"))) TS_NodeFeatures_requires_onion_messages(uint64_t this_arg) {
49137         LDKNodeFeatures this_arg_conv;
49138         this_arg_conv.inner = untag_ptr(this_arg);
49139         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49141         this_arg_conv.is_owned = false;
49142         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
49143         return ret_conv;
49144 }
49145
49146 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_optional"))) TS_InitFeatures_set_channel_type_optional(uint64_t this_arg) {
49147         LDKInitFeatures this_arg_conv;
49148         this_arg_conv.inner = untag_ptr(this_arg);
49149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49151         this_arg_conv.is_owned = false;
49152         InitFeatures_set_channel_type_optional(&this_arg_conv);
49153 }
49154
49155 void  __attribute__((export_name("TS_InitFeatures_set_channel_type_required"))) TS_InitFeatures_set_channel_type_required(uint64_t this_arg) {
49156         LDKInitFeatures this_arg_conv;
49157         this_arg_conv.inner = untag_ptr(this_arg);
49158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49160         this_arg_conv.is_owned = false;
49161         InitFeatures_set_channel_type_required(&this_arg_conv);
49162 }
49163
49164 jboolean  __attribute__((export_name("TS_InitFeatures_supports_channel_type"))) TS_InitFeatures_supports_channel_type(uint64_t this_arg) {
49165         LDKInitFeatures this_arg_conv;
49166         this_arg_conv.inner = untag_ptr(this_arg);
49167         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49169         this_arg_conv.is_owned = false;
49170         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
49171         return ret_conv;
49172 }
49173
49174 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_optional"))) TS_NodeFeatures_set_channel_type_optional(uint64_t this_arg) {
49175         LDKNodeFeatures this_arg_conv;
49176         this_arg_conv.inner = untag_ptr(this_arg);
49177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49179         this_arg_conv.is_owned = false;
49180         NodeFeatures_set_channel_type_optional(&this_arg_conv);
49181 }
49182
49183 void  __attribute__((export_name("TS_NodeFeatures_set_channel_type_required"))) TS_NodeFeatures_set_channel_type_required(uint64_t this_arg) {
49184         LDKNodeFeatures this_arg_conv;
49185         this_arg_conv.inner = untag_ptr(this_arg);
49186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49188         this_arg_conv.is_owned = false;
49189         NodeFeatures_set_channel_type_required(&this_arg_conv);
49190 }
49191
49192 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_channel_type"))) TS_NodeFeatures_supports_channel_type(uint64_t this_arg) {
49193         LDKNodeFeatures this_arg_conv;
49194         this_arg_conv.inner = untag_ptr(this_arg);
49195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49197         this_arg_conv.is_owned = false;
49198         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
49199         return ret_conv;
49200 }
49201
49202 jboolean  __attribute__((export_name("TS_InitFeatures_requires_channel_type"))) TS_InitFeatures_requires_channel_type(uint64_t this_arg) {
49203         LDKInitFeatures this_arg_conv;
49204         this_arg_conv.inner = untag_ptr(this_arg);
49205         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49206         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49207         this_arg_conv.is_owned = false;
49208         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
49209         return ret_conv;
49210 }
49211
49212 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_channel_type"))) TS_NodeFeatures_requires_channel_type(uint64_t this_arg) {
49213         LDKNodeFeatures this_arg_conv;
49214         this_arg_conv.inner = untag_ptr(this_arg);
49215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49217         this_arg_conv.is_owned = false;
49218         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
49219         return ret_conv;
49220 }
49221
49222 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_optional"))) TS_InitFeatures_set_scid_privacy_optional(uint64_t this_arg) {
49223         LDKInitFeatures this_arg_conv;
49224         this_arg_conv.inner = untag_ptr(this_arg);
49225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49227         this_arg_conv.is_owned = false;
49228         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
49229 }
49230
49231 void  __attribute__((export_name("TS_InitFeatures_set_scid_privacy_required"))) TS_InitFeatures_set_scid_privacy_required(uint64_t this_arg) {
49232         LDKInitFeatures this_arg_conv;
49233         this_arg_conv.inner = untag_ptr(this_arg);
49234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49236         this_arg_conv.is_owned = false;
49237         InitFeatures_set_scid_privacy_required(&this_arg_conv);
49238 }
49239
49240 jboolean  __attribute__((export_name("TS_InitFeatures_supports_scid_privacy"))) TS_InitFeatures_supports_scid_privacy(uint64_t this_arg) {
49241         LDKInitFeatures this_arg_conv;
49242         this_arg_conv.inner = untag_ptr(this_arg);
49243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49245         this_arg_conv.is_owned = false;
49246         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
49247         return ret_conv;
49248 }
49249
49250 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_optional"))) TS_NodeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
49251         LDKNodeFeatures this_arg_conv;
49252         this_arg_conv.inner = untag_ptr(this_arg);
49253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49255         this_arg_conv.is_owned = false;
49256         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
49257 }
49258
49259 void  __attribute__((export_name("TS_NodeFeatures_set_scid_privacy_required"))) TS_NodeFeatures_set_scid_privacy_required(uint64_t this_arg) {
49260         LDKNodeFeatures this_arg_conv;
49261         this_arg_conv.inner = untag_ptr(this_arg);
49262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49264         this_arg_conv.is_owned = false;
49265         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
49266 }
49267
49268 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_scid_privacy"))) TS_NodeFeatures_supports_scid_privacy(uint64_t this_arg) {
49269         LDKNodeFeatures this_arg_conv;
49270         this_arg_conv.inner = untag_ptr(this_arg);
49271         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49273         this_arg_conv.is_owned = false;
49274         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
49275         return ret_conv;
49276 }
49277
49278 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_optional"))) TS_ChannelTypeFeatures_set_scid_privacy_optional(uint64_t this_arg) {
49279         LDKChannelTypeFeatures this_arg_conv;
49280         this_arg_conv.inner = untag_ptr(this_arg);
49281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49283         this_arg_conv.is_owned = false;
49284         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
49285 }
49286
49287 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_scid_privacy_required"))) TS_ChannelTypeFeatures_set_scid_privacy_required(uint64_t this_arg) {
49288         LDKChannelTypeFeatures this_arg_conv;
49289         this_arg_conv.inner = untag_ptr(this_arg);
49290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49292         this_arg_conv.is_owned = false;
49293         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
49294 }
49295
49296 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_scid_privacy"))) TS_ChannelTypeFeatures_supports_scid_privacy(uint64_t this_arg) {
49297         LDKChannelTypeFeatures this_arg_conv;
49298         this_arg_conv.inner = untag_ptr(this_arg);
49299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49301         this_arg_conv.is_owned = false;
49302         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
49303         return ret_conv;
49304 }
49305
49306 jboolean  __attribute__((export_name("TS_InitFeatures_requires_scid_privacy"))) TS_InitFeatures_requires_scid_privacy(uint64_t this_arg) {
49307         LDKInitFeatures this_arg_conv;
49308         this_arg_conv.inner = untag_ptr(this_arg);
49309         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49311         this_arg_conv.is_owned = false;
49312         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
49313         return ret_conv;
49314 }
49315
49316 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_scid_privacy"))) TS_NodeFeatures_requires_scid_privacy(uint64_t this_arg) {
49317         LDKNodeFeatures this_arg_conv;
49318         this_arg_conv.inner = untag_ptr(this_arg);
49319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49321         this_arg_conv.is_owned = false;
49322         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
49323         return ret_conv;
49324 }
49325
49326 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_scid_privacy"))) TS_ChannelTypeFeatures_requires_scid_privacy(uint64_t this_arg) {
49327         LDKChannelTypeFeatures this_arg_conv;
49328         this_arg_conv.inner = untag_ptr(this_arg);
49329         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49331         this_arg_conv.is_owned = false;
49332         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
49333         return ret_conv;
49334 }
49335
49336 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_optional"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_optional(uint64_t this_arg) {
49337         LDKBolt11InvoiceFeatures this_arg_conv;
49338         this_arg_conv.inner = untag_ptr(this_arg);
49339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49341         this_arg_conv.is_owned = false;
49342         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
49343 }
49344
49345 void  __attribute__((export_name("TS_Bolt11InvoiceFeatures_set_payment_metadata_required"))) TS_Bolt11InvoiceFeatures_set_payment_metadata_required(uint64_t this_arg) {
49346         LDKBolt11InvoiceFeatures this_arg_conv;
49347         this_arg_conv.inner = untag_ptr(this_arg);
49348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49350         this_arg_conv.is_owned = false;
49351         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
49352 }
49353
49354 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_supports_payment_metadata"))) TS_Bolt11InvoiceFeatures_supports_payment_metadata(uint64_t this_arg) {
49355         LDKBolt11InvoiceFeatures this_arg_conv;
49356         this_arg_conv.inner = untag_ptr(this_arg);
49357         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49359         this_arg_conv.is_owned = false;
49360         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
49361         return ret_conv;
49362 }
49363
49364 jboolean  __attribute__((export_name("TS_Bolt11InvoiceFeatures_requires_payment_metadata"))) TS_Bolt11InvoiceFeatures_requires_payment_metadata(uint64_t this_arg) {
49365         LDKBolt11InvoiceFeatures this_arg_conv;
49366         this_arg_conv.inner = untag_ptr(this_arg);
49367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49369         this_arg_conv.is_owned = false;
49370         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
49371         return ret_conv;
49372 }
49373
49374 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_optional"))) TS_InitFeatures_set_zero_conf_optional(uint64_t this_arg) {
49375         LDKInitFeatures this_arg_conv;
49376         this_arg_conv.inner = untag_ptr(this_arg);
49377         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49379         this_arg_conv.is_owned = false;
49380         InitFeatures_set_zero_conf_optional(&this_arg_conv);
49381 }
49382
49383 void  __attribute__((export_name("TS_InitFeatures_set_zero_conf_required"))) TS_InitFeatures_set_zero_conf_required(uint64_t this_arg) {
49384         LDKInitFeatures this_arg_conv;
49385         this_arg_conv.inner = untag_ptr(this_arg);
49386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49388         this_arg_conv.is_owned = false;
49389         InitFeatures_set_zero_conf_required(&this_arg_conv);
49390 }
49391
49392 jboolean  __attribute__((export_name("TS_InitFeatures_supports_zero_conf"))) TS_InitFeatures_supports_zero_conf(uint64_t this_arg) {
49393         LDKInitFeatures this_arg_conv;
49394         this_arg_conv.inner = untag_ptr(this_arg);
49395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49397         this_arg_conv.is_owned = false;
49398         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
49399         return ret_conv;
49400 }
49401
49402 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_optional"))) TS_NodeFeatures_set_zero_conf_optional(uint64_t this_arg) {
49403         LDKNodeFeatures this_arg_conv;
49404         this_arg_conv.inner = untag_ptr(this_arg);
49405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49407         this_arg_conv.is_owned = false;
49408         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
49409 }
49410
49411 void  __attribute__((export_name("TS_NodeFeatures_set_zero_conf_required"))) TS_NodeFeatures_set_zero_conf_required(uint64_t this_arg) {
49412         LDKNodeFeatures this_arg_conv;
49413         this_arg_conv.inner = untag_ptr(this_arg);
49414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49416         this_arg_conv.is_owned = false;
49417         NodeFeatures_set_zero_conf_required(&this_arg_conv);
49418 }
49419
49420 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_zero_conf"))) TS_NodeFeatures_supports_zero_conf(uint64_t this_arg) {
49421         LDKNodeFeatures this_arg_conv;
49422         this_arg_conv.inner = untag_ptr(this_arg);
49423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49425         this_arg_conv.is_owned = false;
49426         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
49427         return ret_conv;
49428 }
49429
49430 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_optional"))) TS_ChannelTypeFeatures_set_zero_conf_optional(uint64_t this_arg) {
49431         LDKChannelTypeFeatures this_arg_conv;
49432         this_arg_conv.inner = untag_ptr(this_arg);
49433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49435         this_arg_conv.is_owned = false;
49436         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
49437 }
49438
49439 void  __attribute__((export_name("TS_ChannelTypeFeatures_set_zero_conf_required"))) TS_ChannelTypeFeatures_set_zero_conf_required(uint64_t this_arg) {
49440         LDKChannelTypeFeatures this_arg_conv;
49441         this_arg_conv.inner = untag_ptr(this_arg);
49442         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49444         this_arg_conv.is_owned = false;
49445         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
49446 }
49447
49448 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_supports_zero_conf"))) TS_ChannelTypeFeatures_supports_zero_conf(uint64_t this_arg) {
49449         LDKChannelTypeFeatures this_arg_conv;
49450         this_arg_conv.inner = untag_ptr(this_arg);
49451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49453         this_arg_conv.is_owned = false;
49454         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
49455         return ret_conv;
49456 }
49457
49458 jboolean  __attribute__((export_name("TS_InitFeatures_requires_zero_conf"))) TS_InitFeatures_requires_zero_conf(uint64_t this_arg) {
49459         LDKInitFeatures this_arg_conv;
49460         this_arg_conv.inner = untag_ptr(this_arg);
49461         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49463         this_arg_conv.is_owned = false;
49464         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
49465         return ret_conv;
49466 }
49467
49468 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_zero_conf"))) TS_NodeFeatures_requires_zero_conf(uint64_t this_arg) {
49469         LDKNodeFeatures this_arg_conv;
49470         this_arg_conv.inner = untag_ptr(this_arg);
49471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49473         this_arg_conv.is_owned = false;
49474         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
49475         return ret_conv;
49476 }
49477
49478 jboolean  __attribute__((export_name("TS_ChannelTypeFeatures_requires_zero_conf"))) TS_ChannelTypeFeatures_requires_zero_conf(uint64_t this_arg) {
49479         LDKChannelTypeFeatures this_arg_conv;
49480         this_arg_conv.inner = untag_ptr(this_arg);
49481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49483         this_arg_conv.is_owned = false;
49484         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
49485         return ret_conv;
49486 }
49487
49488 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_optional"))) TS_NodeFeatures_set_keysend_optional(uint64_t this_arg) {
49489         LDKNodeFeatures this_arg_conv;
49490         this_arg_conv.inner = untag_ptr(this_arg);
49491         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49493         this_arg_conv.is_owned = false;
49494         NodeFeatures_set_keysend_optional(&this_arg_conv);
49495 }
49496
49497 void  __attribute__((export_name("TS_NodeFeatures_set_keysend_required"))) TS_NodeFeatures_set_keysend_required(uint64_t this_arg) {
49498         LDKNodeFeatures this_arg_conv;
49499         this_arg_conv.inner = untag_ptr(this_arg);
49500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49502         this_arg_conv.is_owned = false;
49503         NodeFeatures_set_keysend_required(&this_arg_conv);
49504 }
49505
49506 jboolean  __attribute__((export_name("TS_NodeFeatures_supports_keysend"))) TS_NodeFeatures_supports_keysend(uint64_t this_arg) {
49507         LDKNodeFeatures this_arg_conv;
49508         this_arg_conv.inner = untag_ptr(this_arg);
49509         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49511         this_arg_conv.is_owned = false;
49512         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
49513         return ret_conv;
49514 }
49515
49516 jboolean  __attribute__((export_name("TS_NodeFeatures_requires_keysend"))) TS_NodeFeatures_requires_keysend(uint64_t this_arg) {
49517         LDKNodeFeatures this_arg_conv;
49518         this_arg_conv.inner = untag_ptr(this_arg);
49519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49521         this_arg_conv.is_owned = false;
49522         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
49523         return ret_conv;
49524 }
49525
49526 void  __attribute__((export_name("TS_ShutdownScript_free"))) TS_ShutdownScript_free(uint64_t this_obj) {
49527         LDKShutdownScript this_obj_conv;
49528         this_obj_conv.inner = untag_ptr(this_obj);
49529         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49531         ShutdownScript_free(this_obj_conv);
49532 }
49533
49534 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
49535         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
49536         uint64_t ret_ref = 0;
49537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49539         return ret_ref;
49540 }
49541 int64_t  __attribute__((export_name("TS_ShutdownScript_clone_ptr"))) TS_ShutdownScript_clone_ptr(uint64_t arg) {
49542         LDKShutdownScript arg_conv;
49543         arg_conv.inner = untag_ptr(arg);
49544         arg_conv.is_owned = ptr_is_owned(arg);
49545         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49546         arg_conv.is_owned = false;
49547         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
49548         return ret_conv;
49549 }
49550
49551 uint64_t  __attribute__((export_name("TS_ShutdownScript_clone"))) TS_ShutdownScript_clone(uint64_t orig) {
49552         LDKShutdownScript orig_conv;
49553         orig_conv.inner = untag_ptr(orig);
49554         orig_conv.is_owned = ptr_is_owned(orig);
49555         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49556         orig_conv.is_owned = false;
49557         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
49558         uint64_t ret_ref = 0;
49559         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49560         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49561         return ret_ref;
49562 }
49563
49564 jboolean  __attribute__((export_name("TS_ShutdownScript_eq"))) TS_ShutdownScript_eq(uint64_t a, uint64_t b) {
49565         LDKShutdownScript a_conv;
49566         a_conv.inner = untag_ptr(a);
49567         a_conv.is_owned = ptr_is_owned(a);
49568         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49569         a_conv.is_owned = false;
49570         LDKShutdownScript b_conv;
49571         b_conv.inner = untag_ptr(b);
49572         b_conv.is_owned = ptr_is_owned(b);
49573         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49574         b_conv.is_owned = false;
49575         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
49576         return ret_conv;
49577 }
49578
49579 void  __attribute__((export_name("TS_InvalidShutdownScript_free"))) TS_InvalidShutdownScript_free(uint64_t this_obj) {
49580         LDKInvalidShutdownScript this_obj_conv;
49581         this_obj_conv.inner = untag_ptr(this_obj);
49582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49584         InvalidShutdownScript_free(this_obj_conv);
49585 }
49586
49587 int8_tArray  __attribute__((export_name("TS_InvalidShutdownScript_get_script"))) TS_InvalidShutdownScript_get_script(uint64_t this_ptr) {
49588         LDKInvalidShutdownScript this_ptr_conv;
49589         this_ptr_conv.inner = untag_ptr(this_ptr);
49590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49592         this_ptr_conv.is_owned = false;
49593         LDKu8slice ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
49594         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49595         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49596         return ret_arr;
49597 }
49598
49599 void  __attribute__((export_name("TS_InvalidShutdownScript_set_script"))) TS_InvalidShutdownScript_set_script(uint64_t this_ptr, int8_tArray val) {
49600         LDKInvalidShutdownScript this_ptr_conv;
49601         this_ptr_conv.inner = untag_ptr(this_ptr);
49602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49604         this_ptr_conv.is_owned = false;
49605         LDKCVec_u8Z val_ref;
49606         val_ref.datalen = val->arr_len;
49607         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
49608         memcpy(val_ref.data, val->elems, val_ref.datalen); FREE(val);
49609         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
49610 }
49611
49612 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_new"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
49613         LDKCVec_u8Z script_arg_ref;
49614         script_arg_ref.datalen = script_arg->arr_len;
49615         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
49616         memcpy(script_arg_ref.data, script_arg->elems, script_arg_ref.datalen); FREE(script_arg);
49617         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
49618         uint64_t ret_ref = 0;
49619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49621         return ret_ref;
49622 }
49623
49624 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
49625         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
49626         uint64_t ret_ref = 0;
49627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49629         return ret_ref;
49630 }
49631 int64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone_ptr"))) TS_InvalidShutdownScript_clone_ptr(uint64_t arg) {
49632         LDKInvalidShutdownScript arg_conv;
49633         arg_conv.inner = untag_ptr(arg);
49634         arg_conv.is_owned = ptr_is_owned(arg);
49635         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49636         arg_conv.is_owned = false;
49637         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
49638         return ret_conv;
49639 }
49640
49641 uint64_t  __attribute__((export_name("TS_InvalidShutdownScript_clone"))) TS_InvalidShutdownScript_clone(uint64_t orig) {
49642         LDKInvalidShutdownScript orig_conv;
49643         orig_conv.inner = untag_ptr(orig);
49644         orig_conv.is_owned = ptr_is_owned(orig);
49645         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49646         orig_conv.is_owned = false;
49647         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
49648         uint64_t ret_ref = 0;
49649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49651         return ret_ref;
49652 }
49653
49654 int8_tArray  __attribute__((export_name("TS_ShutdownScript_write"))) TS_ShutdownScript_write(uint64_t obj) {
49655         LDKShutdownScript obj_conv;
49656         obj_conv.inner = untag_ptr(obj);
49657         obj_conv.is_owned = ptr_is_owned(obj);
49658         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49659         obj_conv.is_owned = false;
49660         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
49661         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49662         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49663         CVec_u8Z_free(ret_var);
49664         return ret_arr;
49665 }
49666
49667 uint64_t  __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScript_read(int8_tArray ser) {
49668         LDKu8slice ser_ref;
49669         ser_ref.datalen = ser->arr_len;
49670         ser_ref.data = ser->elems;
49671         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
49672         *ret_conv = ShutdownScript_read(ser_ref);
49673         FREE(ser);
49674         return tag_ptr(ret_conv, true);
49675 }
49676
49677 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
49678         uint8_t pubkey_hash_arr[20];
49679         CHECK(pubkey_hash->arr_len == 20);
49680         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
49681         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
49682         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
49683         uint64_t ret_ref = 0;
49684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49686         return ret_ref;
49687 }
49688
49689 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
49690         uint8_t script_hash_arr[32];
49691         CHECK(script_hash->arr_len == 32);
49692         memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash);
49693         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
49694         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
49695         uint64_t ret_ref = 0;
49696         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49697         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49698         return ret_ref;
49699 }
49700
49701 uint64_t  __attribute__((export_name("TS_ShutdownScript_new_witness_program"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
49702         
49703         LDKu8slice program_ref;
49704         program_ref.datalen = program->arr_len;
49705         program_ref.data = program->elems;
49706         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
49707         *ret_conv = ShutdownScript_new_witness_program((LDKWitnessVersion){ ._0 = version }, program_ref);
49708         FREE(program);
49709         return tag_ptr(ret_conv, true);
49710 }
49711
49712 int8_tArray  __attribute__((export_name("TS_ShutdownScript_into_inner"))) TS_ShutdownScript_into_inner(uint64_t this_arg) {
49713         LDKShutdownScript this_arg_conv;
49714         this_arg_conv.inner = untag_ptr(this_arg);
49715         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49717         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
49718         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
49719         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
49720         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
49721         CVec_u8Z_free(ret_var);
49722         return ret_arr;
49723 }
49724
49725 int8_tArray  __attribute__((export_name("TS_ShutdownScript_as_legacy_pubkey"))) TS_ShutdownScript_as_legacy_pubkey(uint64_t this_arg) {
49726         LDKShutdownScript this_arg_conv;
49727         this_arg_conv.inner = untag_ptr(this_arg);
49728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49730         this_arg_conv.is_owned = false;
49731         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
49732         memcpy(ret_arr->elems, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
49733         return ret_arr;
49734 }
49735
49736 jboolean  __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_ShutdownScript_is_compatible(uint64_t this_arg, uint64_t features) {
49737         LDKShutdownScript this_arg_conv;
49738         this_arg_conv.inner = untag_ptr(this_arg);
49739         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49741         this_arg_conv.is_owned = false;
49742         LDKInitFeatures features_conv;
49743         features_conv.inner = untag_ptr(features);
49744         features_conv.is_owned = ptr_is_owned(features);
49745         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
49746         features_conv.is_owned = false;
49747         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
49748         return ret_conv;
49749 }
49750
49751 void  __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) {
49752         if (!ptr_is_owned(this_ptr)) return;
49753         void* this_ptr_ptr = untag_ptr(this_ptr);
49754         CHECK_ACCESS(this_ptr_ptr);
49755         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
49756         FREE(untag_ptr(this_ptr));
49757         Retry_free(this_ptr_conv);
49758 }
49759
49760 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
49761         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49762         *ret_copy = Retry_clone(arg);
49763         uint64_t ret_ref = tag_ptr(ret_copy, true);
49764         return ret_ref;
49765 }
49766 int64_t  __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) {
49767         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
49768         int64_t ret_conv = Retry_clone_ptr(arg_conv);
49769         return ret_conv;
49770 }
49771
49772 uint64_t  __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) {
49773         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
49774         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49775         *ret_copy = Retry_clone(orig_conv);
49776         uint64_t ret_ref = tag_ptr(ret_copy, true);
49777         return ret_ref;
49778 }
49779
49780 uint64_t  __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) {
49781         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
49782         *ret_copy = Retry_attempts(a);
49783         uint64_t ret_ref = tag_ptr(ret_copy, true);
49784         return ret_ref;
49785 }
49786
49787 jboolean  __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) {
49788         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
49789         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
49790         jboolean ret_conv = Retry_eq(a_conv, b_conv);
49791         return ret_conv;
49792 }
49793
49794 int64_t  __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) {
49795         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
49796         int64_t ret_conv = Retry_hash(o_conv);
49797         return ret_conv;
49798 }
49799
49800 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) {
49801         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
49802         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv));
49803         return ret_conv;
49804 }
49805
49806 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() {
49807         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired());
49808         return ret_conv;
49809 }
49810
49811 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() {
49812         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found());
49813         return ret_conv;
49814 }
49815
49816 uint32_t  __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() {
49817         uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment());
49818         return ret_conv;
49819 }
49820
49821 jboolean  __attribute__((export_name("TS_RetryableSendFailure_eq"))) TS_RetryableSendFailure_eq(uint64_t a, uint64_t b) {
49822         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
49823         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
49824         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
49825         return ret_conv;
49826 }
49827
49828 void  __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) {
49829         if (!ptr_is_owned(this_ptr)) return;
49830         void* this_ptr_ptr = untag_ptr(this_ptr);
49831         CHECK_ACCESS(this_ptr_ptr);
49832         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
49833         FREE(untag_ptr(this_ptr));
49834         PaymentSendFailure_free(this_ptr_conv);
49835 }
49836
49837 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
49838         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49839         *ret_copy = PaymentSendFailure_clone(arg);
49840         uint64_t ret_ref = tag_ptr(ret_copy, true);
49841         return ret_ref;
49842 }
49843 int64_t  __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) {
49844         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
49845         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
49846         return ret_conv;
49847 }
49848
49849 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) {
49850         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
49851         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49852         *ret_copy = PaymentSendFailure_clone(orig_conv);
49853         uint64_t ret_ref = tag_ptr(ret_copy, true);
49854         return ret_ref;
49855 }
49856
49857 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) {
49858         void* a_ptr = untag_ptr(a);
49859         CHECK_ACCESS(a_ptr);
49860         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
49861         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
49862         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49863         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
49864         uint64_t ret_ref = tag_ptr(ret_copy, true);
49865         return ret_ref;
49866 }
49867
49868 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) {
49869         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
49870         a_constr.datalen = a->arr_len;
49871         if (a_constr.datalen > 0)
49872                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
49873         else
49874                 a_constr.data = NULL;
49875         uint64_t* a_vals = a->elems;
49876         for (size_t w = 0; w < a_constr.datalen; w++) {
49877                 uint64_t a_conv_22 = a_vals[w];
49878                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
49879                 CHECK_ACCESS(a_conv_22_ptr);
49880                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
49881                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
49882                 a_constr.data[w] = a_conv_22_conv;
49883         }
49884         FREE(a);
49885         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49886         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
49887         uint64_t ret_ref = tag_ptr(ret_copy, true);
49888         return ret_ref;
49889 }
49890
49891 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) {
49892         LDKCVec_APIErrorZ a_constr;
49893         a_constr.datalen = a->arr_len;
49894         if (a_constr.datalen > 0)
49895                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
49896         else
49897                 a_constr.data = NULL;
49898         uint64_t* a_vals = a->elems;
49899         for (size_t k = 0; k < a_constr.datalen; k++) {
49900                 uint64_t a_conv_10 = a_vals[k];
49901                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
49902                 CHECK_ACCESS(a_conv_10_ptr);
49903                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
49904                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
49905                 a_constr.data[k] = a_conv_10_conv;
49906         }
49907         FREE(a);
49908         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49909         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
49910         uint64_t ret_ref = tag_ptr(ret_copy, true);
49911         return ret_ref;
49912 }
49913
49914 uint64_t  __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() {
49915         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49916         *ret_copy = PaymentSendFailure_duplicate_payment();
49917         uint64_t ret_ref = tag_ptr(ret_copy, true);
49918         return ret_ref;
49919 }
49920
49921 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) {
49922         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
49923         results_constr.datalen = results->arr_len;
49924         if (results_constr.datalen > 0)
49925                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
49926         else
49927                 results_constr.data = NULL;
49928         uint64_t* results_vals = results->elems;
49929         for (size_t w = 0; w < results_constr.datalen; w++) {
49930                 uint64_t results_conv_22 = results_vals[w];
49931                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
49932                 CHECK_ACCESS(results_conv_22_ptr);
49933                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
49934                 results_constr.data[w] = results_conv_22_conv;
49935         }
49936         FREE(results);
49937         LDKRouteParameters failed_paths_retry_conv;
49938         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
49939         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
49940         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
49941         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
49942         LDKThirtyTwoBytes payment_id_ref;
49943         CHECK(payment_id->arr_len == 32);
49944         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
49945         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
49946         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
49947         uint64_t ret_ref = tag_ptr(ret_copy, true);
49948         return ret_ref;
49949 }
49950
49951 void  __attribute__((export_name("TS_RecipientOnionFields_free"))) TS_RecipientOnionFields_free(uint64_t this_obj) {
49952         LDKRecipientOnionFields this_obj_conv;
49953         this_obj_conv.inner = untag_ptr(this_obj);
49954         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49956         RecipientOnionFields_free(this_obj_conv);
49957 }
49958
49959 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_secret"))) TS_RecipientOnionFields_get_payment_secret(uint64_t this_ptr) {
49960         LDKRecipientOnionFields this_ptr_conv;
49961         this_ptr_conv.inner = untag_ptr(this_ptr);
49962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49964         this_ptr_conv.is_owned = false;
49965         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
49966         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
49967         uint64_t ret_ref = tag_ptr(ret_copy, true);
49968         return ret_ref;
49969 }
49970
49971 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_secret"))) TS_RecipientOnionFields_set_payment_secret(uint64_t this_ptr, uint64_t val) {
49972         LDKRecipientOnionFields this_ptr_conv;
49973         this_ptr_conv.inner = untag_ptr(this_ptr);
49974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49976         this_ptr_conv.is_owned = false;
49977         void* val_ptr = untag_ptr(val);
49978         CHECK_ACCESS(val_ptr);
49979         LDKCOption_PaymentSecretZ val_conv = *(LDKCOption_PaymentSecretZ*)(val_ptr);
49980         val_conv = COption_PaymentSecretZ_clone((LDKCOption_PaymentSecretZ*)untag_ptr(val));
49981         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
49982 }
49983
49984 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_get_payment_metadata"))) TS_RecipientOnionFields_get_payment_metadata(uint64_t this_ptr) {
49985         LDKRecipientOnionFields this_ptr_conv;
49986         this_ptr_conv.inner = untag_ptr(this_ptr);
49987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49989         this_ptr_conv.is_owned = false;
49990         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
49991         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
49992         uint64_t ret_ref = tag_ptr(ret_copy, true);
49993         return ret_ref;
49994 }
49995
49996 void  __attribute__((export_name("TS_RecipientOnionFields_set_payment_metadata"))) TS_RecipientOnionFields_set_payment_metadata(uint64_t this_ptr, uint64_t val) {
49997         LDKRecipientOnionFields this_ptr_conv;
49998         this_ptr_conv.inner = untag_ptr(this_ptr);
49999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50001         this_ptr_conv.is_owned = false;
50002         void* val_ptr = untag_ptr(val);
50003         CHECK_ACCESS(val_ptr);
50004         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
50005         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
50006         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
50007 }
50008
50009 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_new"))) TS_RecipientOnionFields_new(uint64_t payment_secret_arg, uint64_t payment_metadata_arg) {
50010         void* payment_secret_arg_ptr = untag_ptr(payment_secret_arg);
50011         CHECK_ACCESS(payment_secret_arg_ptr);
50012         LDKCOption_PaymentSecretZ payment_secret_arg_conv = *(LDKCOption_PaymentSecretZ*)(payment_secret_arg_ptr);
50013         payment_secret_arg_conv = COption_PaymentSecretZ_clone((LDKCOption_PaymentSecretZ*)untag_ptr(payment_secret_arg));
50014         void* payment_metadata_arg_ptr = untag_ptr(payment_metadata_arg);
50015         CHECK_ACCESS(payment_metadata_arg_ptr);
50016         LDKCOption_CVec_u8ZZ payment_metadata_arg_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_arg_ptr);
50017         payment_metadata_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata_arg));
50018         LDKRecipientOnionFields ret_var = RecipientOnionFields_new(payment_secret_arg_conv, payment_metadata_arg_conv);
50019         uint64_t ret_ref = 0;
50020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50022         return ret_ref;
50023 }
50024
50025 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
50026         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
50027         uint64_t ret_ref = 0;
50028         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50029         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50030         return ret_ref;
50031 }
50032 int64_t  __attribute__((export_name("TS_RecipientOnionFields_clone_ptr"))) TS_RecipientOnionFields_clone_ptr(uint64_t arg) {
50033         LDKRecipientOnionFields arg_conv;
50034         arg_conv.inner = untag_ptr(arg);
50035         arg_conv.is_owned = ptr_is_owned(arg);
50036         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50037         arg_conv.is_owned = false;
50038         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
50039         return ret_conv;
50040 }
50041
50042 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_clone"))) TS_RecipientOnionFields_clone(uint64_t orig) {
50043         LDKRecipientOnionFields orig_conv;
50044         orig_conv.inner = untag_ptr(orig);
50045         orig_conv.is_owned = ptr_is_owned(orig);
50046         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50047         orig_conv.is_owned = false;
50048         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
50049         uint64_t ret_ref = 0;
50050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50052         return ret_ref;
50053 }
50054
50055 jboolean  __attribute__((export_name("TS_RecipientOnionFields_eq"))) TS_RecipientOnionFields_eq(uint64_t a, uint64_t b) {
50056         LDKRecipientOnionFields a_conv;
50057         a_conv.inner = untag_ptr(a);
50058         a_conv.is_owned = ptr_is_owned(a);
50059         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50060         a_conv.is_owned = false;
50061         LDKRecipientOnionFields b_conv;
50062         b_conv.inner = untag_ptr(b);
50063         b_conv.is_owned = ptr_is_owned(b);
50064         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50065         b_conv.is_owned = false;
50066         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
50067         return ret_conv;
50068 }
50069
50070 int8_tArray  __attribute__((export_name("TS_RecipientOnionFields_write"))) TS_RecipientOnionFields_write(uint64_t obj) {
50071         LDKRecipientOnionFields obj_conv;
50072         obj_conv.inner = untag_ptr(obj);
50073         obj_conv.is_owned = ptr_is_owned(obj);
50074         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50075         obj_conv.is_owned = false;
50076         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
50077         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50078         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50079         CVec_u8Z_free(ret_var);
50080         return ret_arr;
50081 }
50082
50083 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_read"))) TS_RecipientOnionFields_read(int8_tArray ser) {
50084         LDKu8slice ser_ref;
50085         ser_ref.datalen = ser->arr_len;
50086         ser_ref.data = ser->elems;
50087         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
50088         *ret_conv = RecipientOnionFields_read(ser_ref);
50089         FREE(ser);
50090         return tag_ptr(ret_conv, true);
50091 }
50092
50093 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_secret_only"))) TS_RecipientOnionFields_secret_only(int8_tArray payment_secret) {
50094         LDKThirtyTwoBytes payment_secret_ref;
50095         CHECK(payment_secret->arr_len == 32);
50096         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
50097         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
50098         uint64_t ret_ref = 0;
50099         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50100         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50101         return ret_ref;
50102 }
50103
50104 uint64_t  __attribute__((export_name("TS_RecipientOnionFields_spontaneous_empty"))) TS_RecipientOnionFields_spontaneous_empty() {
50105         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
50106         uint64_t ret_ref = 0;
50107         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50108         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50109         return ret_ref;
50110 }
50111
50112 void  __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) {
50113         if (!ptr_is_owned(this_ptr)) return;
50114         void* this_ptr_ptr = untag_ptr(this_ptr);
50115         CHECK_ACCESS(this_ptr_ptr);
50116         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
50117         FREE(untag_ptr(this_ptr));
50118         CustomMessageReader_free(this_ptr_conv);
50119 }
50120
50121 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
50122         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
50123         *ret_ret = Type_clone(arg);
50124         return tag_ptr(ret_ret, true);
50125 }
50126 int64_t  __attribute__((export_name("TS_Type_clone_ptr"))) TS_Type_clone_ptr(uint64_t arg) {
50127         void* arg_ptr = untag_ptr(arg);
50128         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
50129         LDKType* arg_conv = (LDKType*)arg_ptr;
50130         int64_t ret_conv = Type_clone_ptr(arg_conv);
50131         return ret_conv;
50132 }
50133
50134 uint64_t  __attribute__((export_name("TS_Type_clone"))) TS_Type_clone(uint64_t orig) {
50135         void* orig_ptr = untag_ptr(orig);
50136         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
50137         LDKType* orig_conv = (LDKType*)orig_ptr;
50138         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
50139         *ret_ret = Type_clone(orig_conv);
50140         return tag_ptr(ret_ret, true);
50141 }
50142
50143 void  __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_ptr) {
50144         if (!ptr_is_owned(this_ptr)) return;
50145         void* this_ptr_ptr = untag_ptr(this_ptr);
50146         CHECK_ACCESS(this_ptr_ptr);
50147         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
50148         FREE(untag_ptr(this_ptr));
50149         Type_free(this_ptr_conv);
50150 }
50151
50152 void  __attribute__((export_name("TS_UnsignedBolt12Invoice_free"))) TS_UnsignedBolt12Invoice_free(uint64_t this_obj) {
50153         LDKUnsignedBolt12Invoice this_obj_conv;
50154         this_obj_conv.inner = untag_ptr(this_obj);
50155         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50157         UnsignedBolt12Invoice_free(this_obj_conv);
50158 }
50159
50160 int8_tArray  __attribute__((export_name("TS_UnsignedBolt12Invoice_signing_pubkey"))) TS_UnsignedBolt12Invoice_signing_pubkey(uint64_t this_arg) {
50161         LDKUnsignedBolt12Invoice this_arg_conv;
50162         this_arg_conv.inner = untag_ptr(this_arg);
50163         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50165         this_arg_conv.is_owned = false;
50166         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50167         memcpy(ret_arr->elems, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
50168         return ret_arr;
50169 }
50170
50171 void  __attribute__((export_name("TS_Bolt12Invoice_free"))) TS_Bolt12Invoice_free(uint64_t this_obj) {
50172         LDKBolt12Invoice this_obj_conv;
50173         this_obj_conv.inner = untag_ptr(this_obj);
50174         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50176         Bolt12Invoice_free(this_obj_conv);
50177 }
50178
50179 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
50180         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
50181         uint64_t ret_ref = 0;
50182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50184         return ret_ref;
50185 }
50186 int64_t  __attribute__((export_name("TS_Bolt12Invoice_clone_ptr"))) TS_Bolt12Invoice_clone_ptr(uint64_t arg) {
50187         LDKBolt12Invoice arg_conv;
50188         arg_conv.inner = untag_ptr(arg);
50189         arg_conv.is_owned = ptr_is_owned(arg);
50190         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50191         arg_conv.is_owned = false;
50192         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
50193         return ret_conv;
50194 }
50195
50196 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_clone"))) TS_Bolt12Invoice_clone(uint64_t orig) {
50197         LDKBolt12Invoice orig_conv;
50198         orig_conv.inner = untag_ptr(orig);
50199         orig_conv.is_owned = ptr_is_owned(orig);
50200         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50201         orig_conv.is_owned = false;
50202         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
50203         uint64_t ret_ref = 0;
50204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50206         return ret_ref;
50207 }
50208
50209 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_description"))) TS_Bolt12Invoice_description(uint64_t this_arg) {
50210         LDKBolt12Invoice this_arg_conv;
50211         this_arg_conv.inner = untag_ptr(this_arg);
50212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50214         this_arg_conv.is_owned = false;
50215         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
50216         uint64_t ret_ref = 0;
50217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50219         return ret_ref;
50220 }
50221
50222 int64_t  __attribute__((export_name("TS_Bolt12Invoice_created_at"))) TS_Bolt12Invoice_created_at(uint64_t this_arg) {
50223         LDKBolt12Invoice this_arg_conv;
50224         this_arg_conv.inner = untag_ptr(this_arg);
50225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50227         this_arg_conv.is_owned = false;
50228         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
50229         return ret_conv;
50230 }
50231
50232 int64_t  __attribute__((export_name("TS_Bolt12Invoice_relative_expiry"))) TS_Bolt12Invoice_relative_expiry(uint64_t this_arg) {
50233         LDKBolt12Invoice this_arg_conv;
50234         this_arg_conv.inner = untag_ptr(this_arg);
50235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50237         this_arg_conv.is_owned = false;
50238         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
50239         return ret_conv;
50240 }
50241
50242 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_payment_hash"))) TS_Bolt12Invoice_payment_hash(uint64_t this_arg) {
50243         LDKBolt12Invoice this_arg_conv;
50244         this_arg_conv.inner = untag_ptr(this_arg);
50245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50247         this_arg_conv.is_owned = false;
50248         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50249         memcpy(ret_arr->elems, Bolt12Invoice_payment_hash(&this_arg_conv).data, 32);
50250         return ret_arr;
50251 }
50252
50253 int64_t  __attribute__((export_name("TS_Bolt12Invoice_amount_msats"))) TS_Bolt12Invoice_amount_msats(uint64_t this_arg) {
50254         LDKBolt12Invoice this_arg_conv;
50255         this_arg_conv.inner = untag_ptr(this_arg);
50256         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50257         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50258         this_arg_conv.is_owned = false;
50259         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
50260         return ret_conv;
50261 }
50262
50263 uint64_t  __attribute__((export_name("TS_Bolt12Invoice_features"))) TS_Bolt12Invoice_features(uint64_t this_arg) {
50264         LDKBolt12Invoice this_arg_conv;
50265         this_arg_conv.inner = untag_ptr(this_arg);
50266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50268         this_arg_conv.is_owned = false;
50269         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_features(&this_arg_conv);
50270         uint64_t ret_ref = 0;
50271         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50272         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50273         return ret_ref;
50274 }
50275
50276 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signing_pubkey"))) TS_Bolt12Invoice_signing_pubkey(uint64_t this_arg) {
50277         LDKBolt12Invoice this_arg_conv;
50278         this_arg_conv.inner = untag_ptr(this_arg);
50279         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50281         this_arg_conv.is_owned = false;
50282         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50283         memcpy(ret_arr->elems, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form, 33);
50284         return ret_arr;
50285 }
50286
50287 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_signable_hash"))) TS_Bolt12Invoice_signable_hash(uint64_t this_arg) {
50288         LDKBolt12Invoice this_arg_conv;
50289         this_arg_conv.inner = untag_ptr(this_arg);
50290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50292         this_arg_conv.is_owned = false;
50293         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50294         memcpy(ret_arr->elems, Bolt12Invoice_signable_hash(&this_arg_conv).data, 32);
50295         return ret_arr;
50296 }
50297
50298 jboolean  __attribute__((export_name("TS_Bolt12Invoice_verify"))) TS_Bolt12Invoice_verify(uint64_t this_arg, uint64_t key) {
50299         LDKBolt12Invoice this_arg_conv;
50300         this_arg_conv.inner = untag_ptr(this_arg);
50301         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50303         this_arg_conv.is_owned = false;
50304         LDKExpandedKey key_conv;
50305         key_conv.inner = untag_ptr(key);
50306         key_conv.is_owned = ptr_is_owned(key);
50307         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
50308         key_conv.is_owned = false;
50309         jboolean ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
50310         return ret_conv;
50311 }
50312
50313 int8_tArray  __attribute__((export_name("TS_Bolt12Invoice_write"))) TS_Bolt12Invoice_write(uint64_t obj) {
50314         LDKBolt12Invoice obj_conv;
50315         obj_conv.inner = untag_ptr(obj);
50316         obj_conv.is_owned = ptr_is_owned(obj);
50317         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50318         obj_conv.is_owned = false;
50319         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
50320         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50321         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50322         CVec_u8Z_free(ret_var);
50323         return ret_arr;
50324 }
50325
50326 void  __attribute__((export_name("TS_BlindedPayInfo_free"))) TS_BlindedPayInfo_free(uint64_t this_obj) {
50327         LDKBlindedPayInfo this_obj_conv;
50328         this_obj_conv.inner = untag_ptr(this_obj);
50329         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50330         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50331         BlindedPayInfo_free(this_obj_conv);
50332 }
50333
50334 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_base_msat"))) TS_BlindedPayInfo_get_fee_base_msat(uint64_t this_ptr) {
50335         LDKBlindedPayInfo this_ptr_conv;
50336         this_ptr_conv.inner = untag_ptr(this_ptr);
50337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50339         this_ptr_conv.is_owned = false;
50340         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
50341         return ret_conv;
50342 }
50343
50344 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_base_msat"))) TS_BlindedPayInfo_set_fee_base_msat(uint64_t this_ptr, int32_t val) {
50345         LDKBlindedPayInfo this_ptr_conv;
50346         this_ptr_conv.inner = untag_ptr(this_ptr);
50347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50349         this_ptr_conv.is_owned = false;
50350         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
50351 }
50352
50353 int32_t  __attribute__((export_name("TS_BlindedPayInfo_get_fee_proportional_millionths"))) TS_BlindedPayInfo_get_fee_proportional_millionths(uint64_t this_ptr) {
50354         LDKBlindedPayInfo this_ptr_conv;
50355         this_ptr_conv.inner = untag_ptr(this_ptr);
50356         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50357         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50358         this_ptr_conv.is_owned = false;
50359         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
50360         return ret_conv;
50361 }
50362
50363 void  __attribute__((export_name("TS_BlindedPayInfo_set_fee_proportional_millionths"))) TS_BlindedPayInfo_set_fee_proportional_millionths(uint64_t this_ptr, int32_t val) {
50364         LDKBlindedPayInfo this_ptr_conv;
50365         this_ptr_conv.inner = untag_ptr(this_ptr);
50366         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50367         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50368         this_ptr_conv.is_owned = false;
50369         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
50370 }
50371
50372 int16_t  __attribute__((export_name("TS_BlindedPayInfo_get_cltv_expiry_delta"))) TS_BlindedPayInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
50373         LDKBlindedPayInfo this_ptr_conv;
50374         this_ptr_conv.inner = untag_ptr(this_ptr);
50375         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50376         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50377         this_ptr_conv.is_owned = false;
50378         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
50379         return ret_conv;
50380 }
50381
50382 void  __attribute__((export_name("TS_BlindedPayInfo_set_cltv_expiry_delta"))) TS_BlindedPayInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
50383         LDKBlindedPayInfo this_ptr_conv;
50384         this_ptr_conv.inner = untag_ptr(this_ptr);
50385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50387         this_ptr_conv.is_owned = false;
50388         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
50389 }
50390
50391 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_minimum_msat"))) TS_BlindedPayInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
50392         LDKBlindedPayInfo this_ptr_conv;
50393         this_ptr_conv.inner = untag_ptr(this_ptr);
50394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50396         this_ptr_conv.is_owned = false;
50397         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
50398         return ret_conv;
50399 }
50400
50401 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_minimum_msat"))) TS_BlindedPayInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
50402         LDKBlindedPayInfo this_ptr_conv;
50403         this_ptr_conv.inner = untag_ptr(this_ptr);
50404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50406         this_ptr_conv.is_owned = false;
50407         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
50408 }
50409
50410 int64_t  __attribute__((export_name("TS_BlindedPayInfo_get_htlc_maximum_msat"))) TS_BlindedPayInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
50411         LDKBlindedPayInfo this_ptr_conv;
50412         this_ptr_conv.inner = untag_ptr(this_ptr);
50413         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50414         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50415         this_ptr_conv.is_owned = false;
50416         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
50417         return ret_conv;
50418 }
50419
50420 void  __attribute__((export_name("TS_BlindedPayInfo_set_htlc_maximum_msat"))) TS_BlindedPayInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
50421         LDKBlindedPayInfo this_ptr_conv;
50422         this_ptr_conv.inner = untag_ptr(this_ptr);
50423         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50425         this_ptr_conv.is_owned = false;
50426         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
50427 }
50428
50429 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_get_features"))) TS_BlindedPayInfo_get_features(uint64_t this_ptr) {
50430         LDKBlindedPayInfo this_ptr_conv;
50431         this_ptr_conv.inner = untag_ptr(this_ptr);
50432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50434         this_ptr_conv.is_owned = false;
50435         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
50436         uint64_t ret_ref = 0;
50437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50439         return ret_ref;
50440 }
50441
50442 void  __attribute__((export_name("TS_BlindedPayInfo_set_features"))) TS_BlindedPayInfo_set_features(uint64_t this_ptr, uint64_t val) {
50443         LDKBlindedPayInfo this_ptr_conv;
50444         this_ptr_conv.inner = untag_ptr(this_ptr);
50445         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50447         this_ptr_conv.is_owned = false;
50448         LDKBlindedHopFeatures val_conv;
50449         val_conv.inner = untag_ptr(val);
50450         val_conv.is_owned = ptr_is_owned(val);
50451         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50452         val_conv = BlindedHopFeatures_clone(&val_conv);
50453         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
50454 }
50455
50456 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) {
50457         LDKBlindedHopFeatures features_arg_conv;
50458         features_arg_conv.inner = untag_ptr(features_arg);
50459         features_arg_conv.is_owned = ptr_is_owned(features_arg);
50460         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
50461         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
50462         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);
50463         uint64_t ret_ref = 0;
50464         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50465         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50466         return ret_ref;
50467 }
50468
50469 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
50470         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
50471         uint64_t ret_ref = 0;
50472         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50473         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50474         return ret_ref;
50475 }
50476 int64_t  __attribute__((export_name("TS_BlindedPayInfo_clone_ptr"))) TS_BlindedPayInfo_clone_ptr(uint64_t arg) {
50477         LDKBlindedPayInfo arg_conv;
50478         arg_conv.inner = untag_ptr(arg);
50479         arg_conv.is_owned = ptr_is_owned(arg);
50480         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50481         arg_conv.is_owned = false;
50482         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
50483         return ret_conv;
50484 }
50485
50486 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_clone"))) TS_BlindedPayInfo_clone(uint64_t orig) {
50487         LDKBlindedPayInfo orig_conv;
50488         orig_conv.inner = untag_ptr(orig);
50489         orig_conv.is_owned = ptr_is_owned(orig);
50490         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50491         orig_conv.is_owned = false;
50492         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
50493         uint64_t ret_ref = 0;
50494         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50495         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50496         return ret_ref;
50497 }
50498
50499 int64_t  __attribute__((export_name("TS_BlindedPayInfo_hash"))) TS_BlindedPayInfo_hash(uint64_t o) {
50500         LDKBlindedPayInfo o_conv;
50501         o_conv.inner = untag_ptr(o);
50502         o_conv.is_owned = ptr_is_owned(o);
50503         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50504         o_conv.is_owned = false;
50505         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
50506         return ret_conv;
50507 }
50508
50509 jboolean  __attribute__((export_name("TS_BlindedPayInfo_eq"))) TS_BlindedPayInfo_eq(uint64_t a, uint64_t b) {
50510         LDKBlindedPayInfo a_conv;
50511         a_conv.inner = untag_ptr(a);
50512         a_conv.is_owned = ptr_is_owned(a);
50513         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50514         a_conv.is_owned = false;
50515         LDKBlindedPayInfo b_conv;
50516         b_conv.inner = untag_ptr(b);
50517         b_conv.is_owned = ptr_is_owned(b);
50518         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50519         b_conv.is_owned = false;
50520         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
50521         return ret_conv;
50522 }
50523
50524 int8_tArray  __attribute__((export_name("TS_BlindedPayInfo_write"))) TS_BlindedPayInfo_write(uint64_t obj) {
50525         LDKBlindedPayInfo obj_conv;
50526         obj_conv.inner = untag_ptr(obj);
50527         obj_conv.is_owned = ptr_is_owned(obj);
50528         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50529         obj_conv.is_owned = false;
50530         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
50531         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50532         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50533         CVec_u8Z_free(ret_var);
50534         return ret_arr;
50535 }
50536
50537 uint64_t  __attribute__((export_name("TS_BlindedPayInfo_read"))) TS_BlindedPayInfo_read(int8_tArray ser) {
50538         LDKu8slice ser_ref;
50539         ser_ref.datalen = ser->arr_len;
50540         ser_ref.data = ser->elems;
50541         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
50542         *ret_conv = BlindedPayInfo_read(ser_ref);
50543         FREE(ser);
50544         return tag_ptr(ret_conv, true);
50545 }
50546
50547 void  __attribute__((export_name("TS_InvoiceError_free"))) TS_InvoiceError_free(uint64_t this_obj) {
50548         LDKInvoiceError this_obj_conv;
50549         this_obj_conv.inner = untag_ptr(this_obj);
50550         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50552         InvoiceError_free(this_obj_conv);
50553 }
50554
50555 uint64_t  __attribute__((export_name("TS_InvoiceError_get_erroneous_field"))) TS_InvoiceError_get_erroneous_field(uint64_t this_ptr) {
50556         LDKInvoiceError this_ptr_conv;
50557         this_ptr_conv.inner = untag_ptr(this_ptr);
50558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50560         this_ptr_conv.is_owned = false;
50561         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
50562         uint64_t ret_ref = 0;
50563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50565         return ret_ref;
50566 }
50567
50568 void  __attribute__((export_name("TS_InvoiceError_set_erroneous_field"))) TS_InvoiceError_set_erroneous_field(uint64_t this_ptr, uint64_t val) {
50569         LDKInvoiceError this_ptr_conv;
50570         this_ptr_conv.inner = untag_ptr(this_ptr);
50571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50573         this_ptr_conv.is_owned = false;
50574         LDKErroneousField val_conv;
50575         val_conv.inner = untag_ptr(val);
50576         val_conv.is_owned = ptr_is_owned(val);
50577         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50578         val_conv = ErroneousField_clone(&val_conv);
50579         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
50580 }
50581
50582 uint64_t  __attribute__((export_name("TS_InvoiceError_get_message"))) TS_InvoiceError_get_message(uint64_t this_ptr) {
50583         LDKInvoiceError this_ptr_conv;
50584         this_ptr_conv.inner = untag_ptr(this_ptr);
50585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50587         this_ptr_conv.is_owned = false;
50588         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
50589         uint64_t ret_ref = 0;
50590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50592         return ret_ref;
50593 }
50594
50595 void  __attribute__((export_name("TS_InvoiceError_set_message"))) TS_InvoiceError_set_message(uint64_t this_ptr, uint64_t val) {
50596         LDKInvoiceError this_ptr_conv;
50597         this_ptr_conv.inner = untag_ptr(this_ptr);
50598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50600         this_ptr_conv.is_owned = false;
50601         LDKUntrustedString val_conv;
50602         val_conv.inner = untag_ptr(val);
50603         val_conv.is_owned = ptr_is_owned(val);
50604         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50605         val_conv = UntrustedString_clone(&val_conv);
50606         InvoiceError_set_message(&this_ptr_conv, val_conv);
50607 }
50608
50609 uint64_t  __attribute__((export_name("TS_InvoiceError_new"))) TS_InvoiceError_new(uint64_t erroneous_field_arg, uint64_t message_arg) {
50610         LDKErroneousField erroneous_field_arg_conv;
50611         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
50612         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
50613         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
50614         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
50615         LDKUntrustedString message_arg_conv;
50616         message_arg_conv.inner = untag_ptr(message_arg);
50617         message_arg_conv.is_owned = ptr_is_owned(message_arg);
50618         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
50619         message_arg_conv = UntrustedString_clone(&message_arg_conv);
50620         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
50621         uint64_t ret_ref = 0;
50622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50624         return ret_ref;
50625 }
50626
50627 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
50628         LDKInvoiceError ret_var = InvoiceError_clone(arg);
50629         uint64_t ret_ref = 0;
50630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50632         return ret_ref;
50633 }
50634 int64_t  __attribute__((export_name("TS_InvoiceError_clone_ptr"))) TS_InvoiceError_clone_ptr(uint64_t arg) {
50635         LDKInvoiceError arg_conv;
50636         arg_conv.inner = untag_ptr(arg);
50637         arg_conv.is_owned = ptr_is_owned(arg);
50638         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50639         arg_conv.is_owned = false;
50640         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
50641         return ret_conv;
50642 }
50643
50644 uint64_t  __attribute__((export_name("TS_InvoiceError_clone"))) TS_InvoiceError_clone(uint64_t orig) {
50645         LDKInvoiceError orig_conv;
50646         orig_conv.inner = untag_ptr(orig);
50647         orig_conv.is_owned = ptr_is_owned(orig);
50648         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50649         orig_conv.is_owned = false;
50650         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
50651         uint64_t ret_ref = 0;
50652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50654         return ret_ref;
50655 }
50656
50657 void  __attribute__((export_name("TS_ErroneousField_free"))) TS_ErroneousField_free(uint64_t this_obj) {
50658         LDKErroneousField this_obj_conv;
50659         this_obj_conv.inner = untag_ptr(this_obj);
50660         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50662         ErroneousField_free(this_obj_conv);
50663 }
50664
50665 int64_t  __attribute__((export_name("TS_ErroneousField_get_tlv_fieldnum"))) TS_ErroneousField_get_tlv_fieldnum(uint64_t this_ptr) {
50666         LDKErroneousField this_ptr_conv;
50667         this_ptr_conv.inner = untag_ptr(this_ptr);
50668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50670         this_ptr_conv.is_owned = false;
50671         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
50672         return ret_conv;
50673 }
50674
50675 void  __attribute__((export_name("TS_ErroneousField_set_tlv_fieldnum"))) TS_ErroneousField_set_tlv_fieldnum(uint64_t this_ptr, int64_t val) {
50676         LDKErroneousField this_ptr_conv;
50677         this_ptr_conv.inner = untag_ptr(this_ptr);
50678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50680         this_ptr_conv.is_owned = false;
50681         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
50682 }
50683
50684 uint64_t  __attribute__((export_name("TS_ErroneousField_get_suggested_value"))) TS_ErroneousField_get_suggested_value(uint64_t this_ptr) {
50685         LDKErroneousField this_ptr_conv;
50686         this_ptr_conv.inner = untag_ptr(this_ptr);
50687         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50688         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50689         this_ptr_conv.is_owned = false;
50690         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
50691         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
50692         uint64_t ret_ref = tag_ptr(ret_copy, true);
50693         return ret_ref;
50694 }
50695
50696 void  __attribute__((export_name("TS_ErroneousField_set_suggested_value"))) TS_ErroneousField_set_suggested_value(uint64_t this_ptr, uint64_t val) {
50697         LDKErroneousField this_ptr_conv;
50698         this_ptr_conv.inner = untag_ptr(this_ptr);
50699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50701         this_ptr_conv.is_owned = false;
50702         void* val_ptr = untag_ptr(val);
50703         CHECK_ACCESS(val_ptr);
50704         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
50705         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
50706         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
50707 }
50708
50709 uint64_t  __attribute__((export_name("TS_ErroneousField_new"))) TS_ErroneousField_new(int64_t tlv_fieldnum_arg, uint64_t suggested_value_arg) {
50710         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
50711         CHECK_ACCESS(suggested_value_arg_ptr);
50712         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
50713         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
50714         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
50715         uint64_t ret_ref = 0;
50716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50718         return ret_ref;
50719 }
50720
50721 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
50722         LDKErroneousField ret_var = ErroneousField_clone(arg);
50723         uint64_t ret_ref = 0;
50724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50726         return ret_ref;
50727 }
50728 int64_t  __attribute__((export_name("TS_ErroneousField_clone_ptr"))) TS_ErroneousField_clone_ptr(uint64_t arg) {
50729         LDKErroneousField arg_conv;
50730         arg_conv.inner = untag_ptr(arg);
50731         arg_conv.is_owned = ptr_is_owned(arg);
50732         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50733         arg_conv.is_owned = false;
50734         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
50735         return ret_conv;
50736 }
50737
50738 uint64_t  __attribute__((export_name("TS_ErroneousField_clone"))) TS_ErroneousField_clone(uint64_t orig) {
50739         LDKErroneousField orig_conv;
50740         orig_conv.inner = untag_ptr(orig);
50741         orig_conv.is_owned = ptr_is_owned(orig);
50742         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50743         orig_conv.is_owned = false;
50744         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
50745         uint64_t ret_ref = 0;
50746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50748         return ret_ref;
50749 }
50750
50751 int8_tArray  __attribute__((export_name("TS_InvoiceError_write"))) TS_InvoiceError_write(uint64_t obj) {
50752         LDKInvoiceError obj_conv;
50753         obj_conv.inner = untag_ptr(obj);
50754         obj_conv.is_owned = ptr_is_owned(obj);
50755         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50756         obj_conv.is_owned = false;
50757         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
50758         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50759         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50760         CVec_u8Z_free(ret_var);
50761         return ret_arr;
50762 }
50763
50764 uint64_t  __attribute__((export_name("TS_InvoiceError_read"))) TS_InvoiceError_read(int8_tArray ser) {
50765         LDKu8slice ser_ref;
50766         ser_ref.datalen = ser->arr_len;
50767         ser_ref.data = ser->elems;
50768         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
50769         *ret_conv = InvoiceError_read(ser_ref);
50770         FREE(ser);
50771         return tag_ptr(ret_conv, true);
50772 }
50773
50774 void  __attribute__((export_name("TS_UnsignedInvoiceRequest_free"))) TS_UnsignedInvoiceRequest_free(uint64_t this_obj) {
50775         LDKUnsignedInvoiceRequest this_obj_conv;
50776         this_obj_conv.inner = untag_ptr(this_obj);
50777         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50779         UnsignedInvoiceRequest_free(this_obj_conv);
50780 }
50781
50782 void  __attribute__((export_name("TS_InvoiceRequest_free"))) TS_InvoiceRequest_free(uint64_t this_obj) {
50783         LDKInvoiceRequest this_obj_conv;
50784         this_obj_conv.inner = untag_ptr(this_obj);
50785         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50787         InvoiceRequest_free(this_obj_conv);
50788 }
50789
50790 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
50791         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
50792         uint64_t ret_ref = 0;
50793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50795         return ret_ref;
50796 }
50797 int64_t  __attribute__((export_name("TS_InvoiceRequest_clone_ptr"))) TS_InvoiceRequest_clone_ptr(uint64_t arg) {
50798         LDKInvoiceRequest arg_conv;
50799         arg_conv.inner = untag_ptr(arg);
50800         arg_conv.is_owned = ptr_is_owned(arg);
50801         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50802         arg_conv.is_owned = false;
50803         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
50804         return ret_conv;
50805 }
50806
50807 uint64_t  __attribute__((export_name("TS_InvoiceRequest_clone"))) TS_InvoiceRequest_clone(uint64_t orig) {
50808         LDKInvoiceRequest orig_conv;
50809         orig_conv.inner = untag_ptr(orig);
50810         orig_conv.is_owned = ptr_is_owned(orig);
50811         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50812         orig_conv.is_owned = false;
50813         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
50814         uint64_t ret_ref = 0;
50815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50817         return ret_ref;
50818 }
50819
50820 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_metadata"))) TS_InvoiceRequest_metadata(uint64_t this_arg) {
50821         LDKInvoiceRequest this_arg_conv;
50822         this_arg_conv.inner = untag_ptr(this_arg);
50823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50825         this_arg_conv.is_owned = false;
50826         LDKu8slice ret_var = InvoiceRequest_metadata(&this_arg_conv);
50827         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50828         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50829         return ret_arr;
50830 }
50831
50832 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_chain"))) TS_InvoiceRequest_chain(uint64_t this_arg) {
50833         LDKInvoiceRequest this_arg_conv;
50834         this_arg_conv.inner = untag_ptr(this_arg);
50835         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50837         this_arg_conv.is_owned = false;
50838         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
50839         memcpy(ret_arr->elems, InvoiceRequest_chain(&this_arg_conv).data, 32);
50840         return ret_arr;
50841 }
50842
50843 uint64_t  __attribute__((export_name("TS_InvoiceRequest_amount_msats"))) TS_InvoiceRequest_amount_msats(uint64_t this_arg) {
50844         LDKInvoiceRequest this_arg_conv;
50845         this_arg_conv.inner = untag_ptr(this_arg);
50846         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50848         this_arg_conv.is_owned = false;
50849         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50850         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
50851         uint64_t ret_ref = tag_ptr(ret_copy, true);
50852         return ret_ref;
50853 }
50854
50855 uint64_t  __attribute__((export_name("TS_InvoiceRequest_features"))) TS_InvoiceRequest_features(uint64_t this_arg) {
50856         LDKInvoiceRequest this_arg_conv;
50857         this_arg_conv.inner = untag_ptr(this_arg);
50858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50860         this_arg_conv.is_owned = false;
50861         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_features(&this_arg_conv);
50862         uint64_t ret_ref = 0;
50863         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50864         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50865         return ret_ref;
50866 }
50867
50868 uint64_t  __attribute__((export_name("TS_InvoiceRequest_quantity"))) TS_InvoiceRequest_quantity(uint64_t this_arg) {
50869         LDKInvoiceRequest this_arg_conv;
50870         this_arg_conv.inner = untag_ptr(this_arg);
50871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50873         this_arg_conv.is_owned = false;
50874         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
50875         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
50876         uint64_t ret_ref = tag_ptr(ret_copy, true);
50877         return ret_ref;
50878 }
50879
50880 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_payer_id"))) TS_InvoiceRequest_payer_id(uint64_t this_arg) {
50881         LDKInvoiceRequest 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         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
50887         memcpy(ret_arr->elems, InvoiceRequest_payer_id(&this_arg_conv).compressed_form, 33);
50888         return ret_arr;
50889 }
50890
50891 uint64_t  __attribute__((export_name("TS_InvoiceRequest_payer_note"))) TS_InvoiceRequest_payer_note(uint64_t this_arg) {
50892         LDKInvoiceRequest this_arg_conv;
50893         this_arg_conv.inner = untag_ptr(this_arg);
50894         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50896         this_arg_conv.is_owned = false;
50897         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
50898         uint64_t ret_ref = 0;
50899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50901         return ret_ref;
50902 }
50903
50904 uint64_t  __attribute__((export_name("TS_InvoiceRequest_verify"))) TS_InvoiceRequest_verify(uint64_t this_arg, uint64_t key) {
50905         LDKInvoiceRequest this_arg_conv;
50906         this_arg_conv.inner = untag_ptr(this_arg);
50907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50909         this_arg_conv.is_owned = false;
50910         LDKExpandedKey key_conv;
50911         key_conv.inner = untag_ptr(key);
50912         key_conv.is_owned = ptr_is_owned(key);
50913         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
50914         key_conv.is_owned = false;
50915         LDKCResult_COption_KeyPairZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_KeyPairZNoneZ), "LDKCResult_COption_KeyPairZNoneZ");
50916         *ret_conv = InvoiceRequest_verify(&this_arg_conv, &key_conv);
50917         return tag_ptr(ret_conv, true);
50918 }
50919
50920 int8_tArray  __attribute__((export_name("TS_InvoiceRequest_write"))) TS_InvoiceRequest_write(uint64_t obj) {
50921         LDKInvoiceRequest obj_conv;
50922         obj_conv.inner = untag_ptr(obj);
50923         obj_conv.is_owned = ptr_is_owned(obj);
50924         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50925         obj_conv.is_owned = false;
50926         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
50927         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
50928         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
50929         CVec_u8Z_free(ret_var);
50930         return ret_arr;
50931 }
50932
50933 void  __attribute__((export_name("TS_Offer_free"))) TS_Offer_free(uint64_t this_obj) {
50934         LDKOffer this_obj_conv;
50935         this_obj_conv.inner = untag_ptr(this_obj);
50936         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50938         Offer_free(this_obj_conv);
50939 }
50940
50941 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
50942         LDKOffer ret_var = Offer_clone(arg);
50943         uint64_t ret_ref = 0;
50944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50946         return ret_ref;
50947 }
50948 int64_t  __attribute__((export_name("TS_Offer_clone_ptr"))) TS_Offer_clone_ptr(uint64_t arg) {
50949         LDKOffer arg_conv;
50950         arg_conv.inner = untag_ptr(arg);
50951         arg_conv.is_owned = ptr_is_owned(arg);
50952         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50953         arg_conv.is_owned = false;
50954         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
50955         return ret_conv;
50956 }
50957
50958 uint64_t  __attribute__((export_name("TS_Offer_clone"))) TS_Offer_clone(uint64_t orig) {
50959         LDKOffer orig_conv;
50960         orig_conv.inner = untag_ptr(orig);
50961         orig_conv.is_owned = ptr_is_owned(orig);
50962         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50963         orig_conv.is_owned = false;
50964         LDKOffer ret_var = Offer_clone(&orig_conv);
50965         uint64_t ret_ref = 0;
50966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50968         return ret_ref;
50969 }
50970
50971 ptrArray  __attribute__((export_name("TS_Offer_chains"))) TS_Offer_chains(uint64_t this_arg) {
50972         LDKOffer this_arg_conv;
50973         this_arg_conv.inner = untag_ptr(this_arg);
50974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50976         this_arg_conv.is_owned = false;
50977         LDKCVec_ChainHashZ ret_var = Offer_chains(&this_arg_conv);
50978         ptrArray ret_arr = NULL;
50979         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
50980         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
50981         for (size_t m = 0; m < ret_var.datalen; m++) {
50982                 int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__);
50983                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32);
50984                 ret_arr_ptr[m] = ret_conv_12_arr;
50985         }
50986         
50987         FREE(ret_var.data);
50988         return ret_arr;
50989 }
50990
50991 jboolean  __attribute__((export_name("TS_Offer_supports_chain"))) TS_Offer_supports_chain(uint64_t this_arg, int8_tArray chain) {
50992         LDKOffer this_arg_conv;
50993         this_arg_conv.inner = untag_ptr(this_arg);
50994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50996         this_arg_conv.is_owned = false;
50997         LDKThirtyTwoBytes chain_ref;
50998         CHECK(chain->arr_len == 32);
50999         memcpy(chain_ref.data, chain->elems, 32); FREE(chain);
51000         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
51001         return ret_conv;
51002 }
51003
51004 uint64_t  __attribute__((export_name("TS_Offer_metadata"))) TS_Offer_metadata(uint64_t this_arg) {
51005         LDKOffer this_arg_conv;
51006         this_arg_conv.inner = untag_ptr(this_arg);
51007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51009         this_arg_conv.is_owned = false;
51010         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
51011         *ret_copy = Offer_metadata(&this_arg_conv);
51012         uint64_t ret_ref = tag_ptr(ret_copy, true);
51013         return ret_ref;
51014 }
51015
51016 uint64_t  __attribute__((export_name("TS_Offer_amount"))) TS_Offer_amount(uint64_t this_arg) {
51017         LDKOffer this_arg_conv;
51018         this_arg_conv.inner = untag_ptr(this_arg);
51019         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51021         this_arg_conv.is_owned = false;
51022         LDKAmount ret_var = Offer_amount(&this_arg_conv);
51023         uint64_t ret_ref = 0;
51024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51026         return ret_ref;
51027 }
51028
51029 uint64_t  __attribute__((export_name("TS_Offer_description"))) TS_Offer_description(uint64_t this_arg) {
51030         LDKOffer this_arg_conv;
51031         this_arg_conv.inner = untag_ptr(this_arg);
51032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51034         this_arg_conv.is_owned = false;
51035         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
51036         uint64_t ret_ref = 0;
51037         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51038         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51039         return ret_ref;
51040 }
51041
51042 uint64_t  __attribute__((export_name("TS_Offer_features"))) TS_Offer_features(uint64_t this_arg) {
51043         LDKOffer this_arg_conv;
51044         this_arg_conv.inner = untag_ptr(this_arg);
51045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51047         this_arg_conv.is_owned = false;
51048         LDKOfferFeatures ret_var = Offer_features(&this_arg_conv);
51049         uint64_t ret_ref = 0;
51050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51052         return ret_ref;
51053 }
51054
51055 uint64_t  __attribute__((export_name("TS_Offer_absolute_expiry"))) TS_Offer_absolute_expiry(uint64_t this_arg) {
51056         LDKOffer this_arg_conv;
51057         this_arg_conv.inner = untag_ptr(this_arg);
51058         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51060         this_arg_conv.is_owned = false;
51061         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
51062         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
51063         uint64_t ret_ref = tag_ptr(ret_copy, true);
51064         return ret_ref;
51065 }
51066
51067 uint64_t  __attribute__((export_name("TS_Offer_issuer"))) TS_Offer_issuer(uint64_t this_arg) {
51068         LDKOffer this_arg_conv;
51069         this_arg_conv.inner = untag_ptr(this_arg);
51070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51072         this_arg_conv.is_owned = false;
51073         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
51074         uint64_t ret_ref = 0;
51075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51077         return ret_ref;
51078 }
51079
51080 uint64_tArray  __attribute__((export_name("TS_Offer_paths"))) TS_Offer_paths(uint64_t this_arg) {
51081         LDKOffer this_arg_conv;
51082         this_arg_conv.inner = untag_ptr(this_arg);
51083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51085         this_arg_conv.is_owned = false;
51086         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
51087         uint64_tArray ret_arr = NULL;
51088         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
51089         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
51090         for (size_t n = 0; n < ret_var.datalen; n++) {
51091                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
51092                 uint64_t ret_conv_13_ref = 0;
51093                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
51094                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
51095                 ret_arr_ptr[n] = ret_conv_13_ref;
51096         }
51097         
51098         FREE(ret_var.data);
51099         return ret_arr;
51100 }
51101
51102 uint64_t  __attribute__((export_name("TS_Offer_supported_quantity"))) TS_Offer_supported_quantity(uint64_t this_arg) {
51103         LDKOffer this_arg_conv;
51104         this_arg_conv.inner = untag_ptr(this_arg);
51105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51107         this_arg_conv.is_owned = false;
51108         LDKQuantity ret_var = Offer_supported_quantity(&this_arg_conv);
51109         uint64_t ret_ref = 0;
51110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51112         return ret_ref;
51113 }
51114
51115 jboolean  __attribute__((export_name("TS_Offer_is_valid_quantity"))) TS_Offer_is_valid_quantity(uint64_t this_arg, int64_t quantity) {
51116         LDKOffer this_arg_conv;
51117         this_arg_conv.inner = untag_ptr(this_arg);
51118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51120         this_arg_conv.is_owned = false;
51121         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
51122         return ret_conv;
51123 }
51124
51125 jboolean  __attribute__((export_name("TS_Offer_expects_quantity"))) TS_Offer_expects_quantity(uint64_t this_arg) {
51126         LDKOffer this_arg_conv;
51127         this_arg_conv.inner = untag_ptr(this_arg);
51128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51130         this_arg_conv.is_owned = false;
51131         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
51132         return ret_conv;
51133 }
51134
51135 int8_tArray  __attribute__((export_name("TS_Offer_signing_pubkey"))) TS_Offer_signing_pubkey(uint64_t this_arg) {
51136         LDKOffer this_arg_conv;
51137         this_arg_conv.inner = untag_ptr(this_arg);
51138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51140         this_arg_conv.is_owned = false;
51141         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51142         memcpy(ret_arr->elems, Offer_signing_pubkey(&this_arg_conv).compressed_form, 33);
51143         return ret_arr;
51144 }
51145
51146 int8_tArray  __attribute__((export_name("TS_Offer_write"))) TS_Offer_write(uint64_t obj) {
51147         LDKOffer obj_conv;
51148         obj_conv.inner = untag_ptr(obj);
51149         obj_conv.is_owned = ptr_is_owned(obj);
51150         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51151         obj_conv.is_owned = false;
51152         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
51153         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51154         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51155         CVec_u8Z_free(ret_var);
51156         return ret_arr;
51157 }
51158
51159 void  __attribute__((export_name("TS_Amount_free"))) TS_Amount_free(uint64_t this_obj) {
51160         LDKAmount this_obj_conv;
51161         this_obj_conv.inner = untag_ptr(this_obj);
51162         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51164         Amount_free(this_obj_conv);
51165 }
51166
51167 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
51168         LDKAmount ret_var = Amount_clone(arg);
51169         uint64_t ret_ref = 0;
51170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51172         return ret_ref;
51173 }
51174 int64_t  __attribute__((export_name("TS_Amount_clone_ptr"))) TS_Amount_clone_ptr(uint64_t arg) {
51175         LDKAmount arg_conv;
51176         arg_conv.inner = untag_ptr(arg);
51177         arg_conv.is_owned = ptr_is_owned(arg);
51178         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51179         arg_conv.is_owned = false;
51180         int64_t ret_conv = Amount_clone_ptr(&arg_conv);
51181         return ret_conv;
51182 }
51183
51184 uint64_t  __attribute__((export_name("TS_Amount_clone"))) TS_Amount_clone(uint64_t orig) {
51185         LDKAmount orig_conv;
51186         orig_conv.inner = untag_ptr(orig);
51187         orig_conv.is_owned = ptr_is_owned(orig);
51188         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51189         orig_conv.is_owned = false;
51190         LDKAmount ret_var = Amount_clone(&orig_conv);
51191         uint64_t ret_ref = 0;
51192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51194         return ret_ref;
51195 }
51196
51197 void  __attribute__((export_name("TS_Quantity_free"))) TS_Quantity_free(uint64_t this_obj) {
51198         LDKQuantity this_obj_conv;
51199         this_obj_conv.inner = untag_ptr(this_obj);
51200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51202         Quantity_free(this_obj_conv);
51203 }
51204
51205 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
51206         LDKQuantity ret_var = Quantity_clone(arg);
51207         uint64_t ret_ref = 0;
51208         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51209         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51210         return ret_ref;
51211 }
51212 int64_t  __attribute__((export_name("TS_Quantity_clone_ptr"))) TS_Quantity_clone_ptr(uint64_t arg) {
51213         LDKQuantity arg_conv;
51214         arg_conv.inner = untag_ptr(arg);
51215         arg_conv.is_owned = ptr_is_owned(arg);
51216         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51217         arg_conv.is_owned = false;
51218         int64_t ret_conv = Quantity_clone_ptr(&arg_conv);
51219         return ret_conv;
51220 }
51221
51222 uint64_t  __attribute__((export_name("TS_Quantity_clone"))) TS_Quantity_clone(uint64_t orig) {
51223         LDKQuantity orig_conv;
51224         orig_conv.inner = untag_ptr(orig);
51225         orig_conv.is_owned = ptr_is_owned(orig);
51226         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51227         orig_conv.is_owned = false;
51228         LDKQuantity ret_var = Quantity_clone(&orig_conv);
51229         uint64_t ret_ref = 0;
51230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51232         return ret_ref;
51233 }
51234
51235 uint64_t  __attribute__((export_name("TS_Offer_from_str"))) TS_Offer_from_str(jstring s) {
51236         LDKStr s_conv = str_ref_to_owned_c(s);
51237         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
51238         *ret_conv = Offer_from_str(s_conv);
51239         return tag_ptr(ret_conv, true);
51240 }
51241
51242 void  __attribute__((export_name("TS_Bolt12ParseError_free"))) TS_Bolt12ParseError_free(uint64_t this_obj) {
51243         LDKBolt12ParseError this_obj_conv;
51244         this_obj_conv.inner = untag_ptr(this_obj);
51245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51247         Bolt12ParseError_free(this_obj_conv);
51248 }
51249
51250 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
51251         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
51252         uint64_t ret_ref = 0;
51253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51255         return ret_ref;
51256 }
51257 int64_t  __attribute__((export_name("TS_Bolt12ParseError_clone_ptr"))) TS_Bolt12ParseError_clone_ptr(uint64_t arg) {
51258         LDKBolt12ParseError arg_conv;
51259         arg_conv.inner = untag_ptr(arg);
51260         arg_conv.is_owned = ptr_is_owned(arg);
51261         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51262         arg_conv.is_owned = false;
51263         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
51264         return ret_conv;
51265 }
51266
51267 uint64_t  __attribute__((export_name("TS_Bolt12ParseError_clone"))) TS_Bolt12ParseError_clone(uint64_t orig) {
51268         LDKBolt12ParseError orig_conv;
51269         orig_conv.inner = untag_ptr(orig);
51270         orig_conv.is_owned = ptr_is_owned(orig);
51271         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51272         orig_conv.is_owned = false;
51273         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
51274         uint64_t ret_ref = 0;
51275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51277         return ret_ref;
51278 }
51279
51280 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_clone"))) TS_Bolt12SemanticError_clone(uint64_t orig) {
51281         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
51282         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_clone(orig_conv));
51283         return ret_conv;
51284 }
51285
51286 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_already_expired"))) TS_Bolt12SemanticError_already_expired() {
51287         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_already_expired());
51288         return ret_conv;
51289 }
51290
51291 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_chain"))) TS_Bolt12SemanticError_unsupported_chain() {
51292         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_chain());
51293         return ret_conv;
51294 }
51295
51296 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_chain"))) TS_Bolt12SemanticError_unexpected_chain() {
51297         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_chain());
51298         return ret_conv;
51299 }
51300
51301 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_amount"))) TS_Bolt12SemanticError_missing_amount() {
51302         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_amount());
51303         return ret_conv;
51304 }
51305
51306 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_amount"))) TS_Bolt12SemanticError_invalid_amount() {
51307         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_amount());
51308         return ret_conv;
51309 }
51310
51311 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_insufficient_amount"))) TS_Bolt12SemanticError_insufficient_amount() {
51312         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_insufficient_amount());
51313         return ret_conv;
51314 }
51315
51316 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_amount"))) TS_Bolt12SemanticError_unexpected_amount() {
51317         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_amount());
51318         return ret_conv;
51319 }
51320
51321 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unsupported_currency"))) TS_Bolt12SemanticError_unsupported_currency() {
51322         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unsupported_currency());
51323         return ret_conv;
51324 }
51325
51326 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unknown_required_features"))) TS_Bolt12SemanticError_unknown_required_features() {
51327         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unknown_required_features());
51328         return ret_conv;
51329 }
51330
51331 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_features"))) TS_Bolt12SemanticError_unexpected_features() {
51332         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_features());
51333         return ret_conv;
51334 }
51335
51336 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_description"))) TS_Bolt12SemanticError_missing_description() {
51337         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_description());
51338         return ret_conv;
51339 }
51340
51341 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signing_pubkey"))) TS_Bolt12SemanticError_missing_signing_pubkey() {
51342         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signing_pubkey());
51343         return ret_conv;
51344 }
51345
51346 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_signing_pubkey"))) TS_Bolt12SemanticError_invalid_signing_pubkey() {
51347         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_signing_pubkey());
51348         return ret_conv;
51349 }
51350
51351 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_signing_pubkey"))) TS_Bolt12SemanticError_unexpected_signing_pubkey() {
51352         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_signing_pubkey());
51353         return ret_conv;
51354 }
51355
51356 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_quantity"))) TS_Bolt12SemanticError_missing_quantity() {
51357         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_quantity());
51358         return ret_conv;
51359 }
51360
51361 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_quantity"))) TS_Bolt12SemanticError_invalid_quantity() {
51362         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_quantity());
51363         return ret_conv;
51364 }
51365
51366 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_quantity"))) TS_Bolt12SemanticError_unexpected_quantity() {
51367         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_quantity());
51368         return ret_conv;
51369 }
51370
51371 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_metadata"))) TS_Bolt12SemanticError_invalid_metadata() {
51372         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_metadata());
51373         return ret_conv;
51374 }
51375
51376 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_unexpected_metadata"))) TS_Bolt12SemanticError_unexpected_metadata() {
51377         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_unexpected_metadata());
51378         return ret_conv;
51379 }
51380
51381 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_metadata"))) TS_Bolt12SemanticError_missing_payer_metadata() {
51382         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_metadata());
51383         return ret_conv;
51384 }
51385
51386 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payer_id"))) TS_Bolt12SemanticError_missing_payer_id() {
51387         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payer_id());
51388         return ret_conv;
51389 }
51390
51391 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_paths"))) TS_Bolt12SemanticError_missing_paths() {
51392         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_paths());
51393         return ret_conv;
51394 }
51395
51396 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_invalid_pay_info"))) TS_Bolt12SemanticError_invalid_pay_info() {
51397         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_invalid_pay_info());
51398         return ret_conv;
51399 }
51400
51401 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_creation_time"))) TS_Bolt12SemanticError_missing_creation_time() {
51402         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_creation_time());
51403         return ret_conv;
51404 }
51405
51406 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_payment_hash"))) TS_Bolt12SemanticError_missing_payment_hash() {
51407         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_payment_hash());
51408         return ret_conv;
51409 }
51410
51411 uint32_t  __attribute__((export_name("TS_Bolt12SemanticError_missing_signature"))) TS_Bolt12SemanticError_missing_signature() {
51412         uint32_t ret_conv = LDKBolt12SemanticError_to_js(Bolt12SemanticError_missing_signature());
51413         return ret_conv;
51414 }
51415
51416 void  __attribute__((export_name("TS_Refund_free"))) TS_Refund_free(uint64_t this_obj) {
51417         LDKRefund this_obj_conv;
51418         this_obj_conv.inner = untag_ptr(this_obj);
51419         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51421         Refund_free(this_obj_conv);
51422 }
51423
51424 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
51425         LDKRefund ret_var = Refund_clone(arg);
51426         uint64_t ret_ref = 0;
51427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51429         return ret_ref;
51430 }
51431 int64_t  __attribute__((export_name("TS_Refund_clone_ptr"))) TS_Refund_clone_ptr(uint64_t arg) {
51432         LDKRefund arg_conv;
51433         arg_conv.inner = untag_ptr(arg);
51434         arg_conv.is_owned = ptr_is_owned(arg);
51435         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51436         arg_conv.is_owned = false;
51437         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
51438         return ret_conv;
51439 }
51440
51441 uint64_t  __attribute__((export_name("TS_Refund_clone"))) TS_Refund_clone(uint64_t orig) {
51442         LDKRefund orig_conv;
51443         orig_conv.inner = untag_ptr(orig);
51444         orig_conv.is_owned = ptr_is_owned(orig);
51445         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51446         orig_conv.is_owned = false;
51447         LDKRefund ret_var = Refund_clone(&orig_conv);
51448         uint64_t ret_ref = 0;
51449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51451         return ret_ref;
51452 }
51453
51454 uint64_t  __attribute__((export_name("TS_Refund_description"))) TS_Refund_description(uint64_t this_arg) {
51455         LDKRefund this_arg_conv;
51456         this_arg_conv.inner = untag_ptr(this_arg);
51457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51459         this_arg_conv.is_owned = false;
51460         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
51461         uint64_t ret_ref = 0;
51462         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51463         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51464         return ret_ref;
51465 }
51466
51467 uint64_t  __attribute__((export_name("TS_Refund_absolute_expiry"))) TS_Refund_absolute_expiry(uint64_t this_arg) {
51468         LDKRefund this_arg_conv;
51469         this_arg_conv.inner = untag_ptr(this_arg);
51470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51472         this_arg_conv.is_owned = false;
51473         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
51474         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
51475         uint64_t ret_ref = tag_ptr(ret_copy, true);
51476         return ret_ref;
51477 }
51478
51479 uint64_t  __attribute__((export_name("TS_Refund_issuer"))) TS_Refund_issuer(uint64_t this_arg) {
51480         LDKRefund this_arg_conv;
51481         this_arg_conv.inner = untag_ptr(this_arg);
51482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51484         this_arg_conv.is_owned = false;
51485         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
51486         uint64_t ret_ref = 0;
51487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51489         return ret_ref;
51490 }
51491
51492 uint64_tArray  __attribute__((export_name("TS_Refund_paths"))) TS_Refund_paths(uint64_t this_arg) {
51493         LDKRefund this_arg_conv;
51494         this_arg_conv.inner = untag_ptr(this_arg);
51495         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51496         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51497         this_arg_conv.is_owned = false;
51498         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
51499         uint64_tArray ret_arr = NULL;
51500         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
51501         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
51502         for (size_t n = 0; n < ret_var.datalen; n++) {
51503                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
51504                 uint64_t ret_conv_13_ref = 0;
51505                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
51506                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
51507                 ret_arr_ptr[n] = ret_conv_13_ref;
51508         }
51509         
51510         FREE(ret_var.data);
51511         return ret_arr;
51512 }
51513
51514 int8_tArray  __attribute__((export_name("TS_Refund_metadata"))) TS_Refund_metadata(uint64_t this_arg) {
51515         LDKRefund this_arg_conv;
51516         this_arg_conv.inner = untag_ptr(this_arg);
51517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51519         this_arg_conv.is_owned = false;
51520         LDKu8slice ret_var = Refund_metadata(&this_arg_conv);
51521         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51522         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51523         return ret_arr;
51524 }
51525
51526 int8_tArray  __attribute__((export_name("TS_Refund_chain"))) TS_Refund_chain(uint64_t this_arg) {
51527         LDKRefund 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         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
51533         memcpy(ret_arr->elems, Refund_chain(&this_arg_conv).data, 32);
51534         return ret_arr;
51535 }
51536
51537 int64_t  __attribute__((export_name("TS_Refund_amount_msats"))) TS_Refund_amount_msats(uint64_t this_arg) {
51538         LDKRefund this_arg_conv;
51539         this_arg_conv.inner = untag_ptr(this_arg);
51540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51542         this_arg_conv.is_owned = false;
51543         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
51544         return ret_conv;
51545 }
51546
51547 uint64_t  __attribute__((export_name("TS_Refund_features"))) TS_Refund_features(uint64_t this_arg) {
51548         LDKRefund this_arg_conv;
51549         this_arg_conv.inner = untag_ptr(this_arg);
51550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51552         this_arg_conv.is_owned = false;
51553         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
51554         uint64_t ret_ref = 0;
51555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51557         return ret_ref;
51558 }
51559
51560 uint64_t  __attribute__((export_name("TS_Refund_quantity"))) TS_Refund_quantity(uint64_t this_arg) {
51561         LDKRefund this_arg_conv;
51562         this_arg_conv.inner = untag_ptr(this_arg);
51563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51565         this_arg_conv.is_owned = false;
51566         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
51567         *ret_copy = Refund_quantity(&this_arg_conv);
51568         uint64_t ret_ref = tag_ptr(ret_copy, true);
51569         return ret_ref;
51570 }
51571
51572 int8_tArray  __attribute__((export_name("TS_Refund_payer_id"))) TS_Refund_payer_id(uint64_t this_arg) {
51573         LDKRefund this_arg_conv;
51574         this_arg_conv.inner = untag_ptr(this_arg);
51575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51577         this_arg_conv.is_owned = false;
51578         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
51579         memcpy(ret_arr->elems, Refund_payer_id(&this_arg_conv).compressed_form, 33);
51580         return ret_arr;
51581 }
51582
51583 uint64_t  __attribute__((export_name("TS_Refund_payer_note"))) TS_Refund_payer_note(uint64_t this_arg) {
51584         LDKRefund this_arg_conv;
51585         this_arg_conv.inner = untag_ptr(this_arg);
51586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51588         this_arg_conv.is_owned = false;
51589         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
51590         uint64_t ret_ref = 0;
51591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51593         return ret_ref;
51594 }
51595
51596 int8_tArray  __attribute__((export_name("TS_Refund_write"))) TS_Refund_write(uint64_t obj) {
51597         LDKRefund obj_conv;
51598         obj_conv.inner = untag_ptr(obj);
51599         obj_conv.is_owned = ptr_is_owned(obj);
51600         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51601         obj_conv.is_owned = false;
51602         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
51603         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51604         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51605         CVec_u8Z_free(ret_var);
51606         return ret_arr;
51607 }
51608
51609 uint64_t  __attribute__((export_name("TS_Refund_from_str"))) TS_Refund_from_str(jstring s) {
51610         LDKStr s_conv = str_ref_to_owned_c(s);
51611         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
51612         *ret_conv = Refund_from_str(s_conv);
51613         return tag_ptr(ret_conv, true);
51614 }
51615
51616 uint32_t  __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) {
51617         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
51618         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv));
51619         return ret_conv;
51620 }
51621
51622 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() {
51623         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain());
51624         return ret_conv;
51625 }
51626
51627 uint32_t  __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() {
51628         uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx());
51629         return ret_conv;
51630 }
51631
51632 void  __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_free(uint64_t this_ptr) {
51633         if (!ptr_is_owned(this_ptr)) return;
51634         void* this_ptr_ptr = untag_ptr(this_ptr);
51635         CHECK_ACCESS(this_ptr_ptr);
51636         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
51637         FREE(untag_ptr(this_ptr));
51638         UtxoResult_free(this_ptr_conv);
51639 }
51640
51641 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
51642         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
51643         *ret_copy = UtxoResult_clone(arg);
51644         uint64_t ret_ref = tag_ptr(ret_copy, true);
51645         return ret_ref;
51646 }
51647 int64_t  __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) {
51648         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
51649         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
51650         return ret_conv;
51651 }
51652
51653 uint64_t  __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) {
51654         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
51655         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
51656         *ret_copy = UtxoResult_clone(orig_conv);
51657         uint64_t ret_ref = tag_ptr(ret_copy, true);
51658         return ret_ref;
51659 }
51660
51661 uint64_t  __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) {
51662         void* a_ptr = untag_ptr(a);
51663         CHECK_ACCESS(a_ptr);
51664         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
51665         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
51666         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
51667         *ret_copy = UtxoResult_sync(a_conv);
51668         uint64_t ret_ref = tag_ptr(ret_copy, true);
51669         return ret_ref;
51670 }
51671
51672 uint64_t  __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) {
51673         LDKUtxoFuture a_conv;
51674         a_conv.inner = untag_ptr(a);
51675         a_conv.is_owned = ptr_is_owned(a);
51676         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51677         a_conv = UtxoFuture_clone(&a_conv);
51678         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
51679         *ret_copy = UtxoResult_async(a_conv);
51680         uint64_t ret_ref = tag_ptr(ret_copy, true);
51681         return ret_ref;
51682 }
51683
51684 void  __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_free(uint64_t this_ptr) {
51685         if (!ptr_is_owned(this_ptr)) return;
51686         void* this_ptr_ptr = untag_ptr(this_ptr);
51687         CHECK_ACCESS(this_ptr_ptr);
51688         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
51689         FREE(untag_ptr(this_ptr));
51690         UtxoLookup_free(this_ptr_conv);
51691 }
51692
51693 void  __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) {
51694         LDKUtxoFuture this_obj_conv;
51695         this_obj_conv.inner = untag_ptr(this_obj);
51696         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51698         UtxoFuture_free(this_obj_conv);
51699 }
51700
51701 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
51702         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
51703         uint64_t ret_ref = 0;
51704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51706         return ret_ref;
51707 }
51708 int64_t  __attribute__((export_name("TS_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) {
51709         LDKUtxoFuture arg_conv;
51710         arg_conv.inner = untag_ptr(arg);
51711         arg_conv.is_owned = ptr_is_owned(arg);
51712         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51713         arg_conv.is_owned = false;
51714         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
51715         return ret_conv;
51716 }
51717
51718 uint64_t  __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) {
51719         LDKUtxoFuture orig_conv;
51720         orig_conv.inner = untag_ptr(orig);
51721         orig_conv.is_owned = ptr_is_owned(orig);
51722         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51723         orig_conv.is_owned = false;
51724         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
51725         uint64_t ret_ref = 0;
51726         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51727         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51728         return ret_ref;
51729 }
51730
51731 uint64_t  __attribute__((export_name("TS_UtxoFuture_new"))) TS_UtxoFuture_new() {
51732         LDKUtxoFuture ret_var = UtxoFuture_new();
51733         uint64_t ret_ref = 0;
51734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51736         return ret_ref;
51737 }
51738
51739 void  __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) {
51740         LDKUtxoFuture this_arg_conv;
51741         this_arg_conv.inner = untag_ptr(this_arg);
51742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51744         this_arg_conv.is_owned = false;
51745         LDKNetworkGraph graph_conv;
51746         graph_conv.inner = untag_ptr(graph);
51747         graph_conv.is_owned = ptr_is_owned(graph);
51748         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
51749         graph_conv.is_owned = false;
51750         void* result_ptr = untag_ptr(result);
51751         CHECK_ACCESS(result_ptr);
51752         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
51753         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
51754 }
51755
51756 void  __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) {
51757         LDKUtxoFuture this_arg_conv;
51758         this_arg_conv.inner = untag_ptr(this_arg);
51759         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51761         this_arg_conv.is_owned = false;
51762         LDKNetworkGraph graph_conv;
51763         graph_conv.inner = untag_ptr(graph);
51764         graph_conv.is_owned = ptr_is_owned(graph);
51765         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
51766         graph_conv.is_owned = false;
51767         LDKP2PGossipSync gossip_conv;
51768         gossip_conv.inner = untag_ptr(gossip);
51769         gossip_conv.is_owned = ptr_is_owned(gossip);
51770         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
51771         gossip_conv.is_owned = false;
51772         void* result_ptr = untag_ptr(result);
51773         CHECK_ACCESS(result_ptr);
51774         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
51775         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
51776 }
51777
51778 void  __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) {
51779         LDKNodeId this_obj_conv;
51780         this_obj_conv.inner = untag_ptr(this_obj);
51781         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51783         NodeId_free(this_obj_conv);
51784 }
51785
51786 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
51787         LDKNodeId ret_var = NodeId_clone(arg);
51788         uint64_t ret_ref = 0;
51789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51791         return ret_ref;
51792 }
51793 int64_t  __attribute__((export_name("TS_NodeId_clone_ptr"))) TS_NodeId_clone_ptr(uint64_t arg) {
51794         LDKNodeId arg_conv;
51795         arg_conv.inner = untag_ptr(arg);
51796         arg_conv.is_owned = ptr_is_owned(arg);
51797         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51798         arg_conv.is_owned = false;
51799         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
51800         return ret_conv;
51801 }
51802
51803 uint64_t  __attribute__((export_name("TS_NodeId_clone"))) TS_NodeId_clone(uint64_t orig) {
51804         LDKNodeId orig_conv;
51805         orig_conv.inner = untag_ptr(orig);
51806         orig_conv.is_owned = ptr_is_owned(orig);
51807         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51808         orig_conv.is_owned = false;
51809         LDKNodeId ret_var = NodeId_clone(&orig_conv);
51810         uint64_t ret_ref = 0;
51811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51813         return ret_ref;
51814 }
51815
51816 uint64_t  __attribute__((export_name("TS_NodeId_from_pubkey"))) TS_NodeId_from_pubkey(int8_tArray pubkey) {
51817         LDKPublicKey pubkey_ref;
51818         CHECK(pubkey->arr_len == 33);
51819         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
51820         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
51821         uint64_t ret_ref = 0;
51822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51824         return ret_ref;
51825 }
51826
51827 int8_tArray  __attribute__((export_name("TS_NodeId_as_slice"))) TS_NodeId_as_slice(uint64_t this_arg) {
51828         LDKNodeId this_arg_conv;
51829         this_arg_conv.inner = untag_ptr(this_arg);
51830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
51831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
51832         this_arg_conv.is_owned = false;
51833         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
51834         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51835         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51836         return ret_arr;
51837 }
51838
51839 uint64_t  __attribute__((export_name("TS_NodeId_as_pubkey"))) TS_NodeId_as_pubkey(uint64_t this_arg) {
51840         LDKNodeId 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         LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
51846         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
51847         return tag_ptr(ret_conv, true);
51848 }
51849
51850 int64_t  __attribute__((export_name("TS_NodeId_hash"))) TS_NodeId_hash(uint64_t o) {
51851         LDKNodeId o_conv;
51852         o_conv.inner = untag_ptr(o);
51853         o_conv.is_owned = ptr_is_owned(o);
51854         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51855         o_conv.is_owned = false;
51856         int64_t ret_conv = NodeId_hash(&o_conv);
51857         return ret_conv;
51858 }
51859
51860 int8_tArray  __attribute__((export_name("TS_NodeId_write"))) TS_NodeId_write(uint64_t obj) {
51861         LDKNodeId obj_conv;
51862         obj_conv.inner = untag_ptr(obj);
51863         obj_conv.is_owned = ptr_is_owned(obj);
51864         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
51865         obj_conv.is_owned = false;
51866         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
51867         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51868         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51869         CVec_u8Z_free(ret_var);
51870         return ret_arr;
51871 }
51872
51873 uint64_t  __attribute__((export_name("TS_NodeId_read"))) TS_NodeId_read(int8_tArray ser) {
51874         LDKu8slice ser_ref;
51875         ser_ref.datalen = ser->arr_len;
51876         ser_ref.data = ser->elems;
51877         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
51878         *ret_conv = NodeId_read(ser_ref);
51879         FREE(ser);
51880         return tag_ptr(ret_conv, true);
51881 }
51882
51883 void  __attribute__((export_name("TS_NetworkGraph_free"))) TS_NetworkGraph_free(uint64_t this_obj) {
51884         LDKNetworkGraph this_obj_conv;
51885         this_obj_conv.inner = untag_ptr(this_obj);
51886         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51888         NetworkGraph_free(this_obj_conv);
51889 }
51890
51891 void  __attribute__((export_name("TS_ReadOnlyNetworkGraph_free"))) TS_ReadOnlyNetworkGraph_free(uint64_t this_obj) {
51892         LDKReadOnlyNetworkGraph this_obj_conv;
51893         this_obj_conv.inner = untag_ptr(this_obj);
51894         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51896         ReadOnlyNetworkGraph_free(this_obj_conv);
51897 }
51898
51899 void  __attribute__((export_name("TS_NetworkUpdate_free"))) TS_NetworkUpdate_free(uint64_t this_ptr) {
51900         if (!ptr_is_owned(this_ptr)) return;
51901         void* this_ptr_ptr = untag_ptr(this_ptr);
51902         CHECK_ACCESS(this_ptr_ptr);
51903         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
51904         FREE(untag_ptr(this_ptr));
51905         NetworkUpdate_free(this_ptr_conv);
51906 }
51907
51908 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
51909         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51910         *ret_copy = NetworkUpdate_clone(arg);
51911         uint64_t ret_ref = tag_ptr(ret_copy, true);
51912         return ret_ref;
51913 }
51914 int64_t  __attribute__((export_name("TS_NetworkUpdate_clone_ptr"))) TS_NetworkUpdate_clone_ptr(uint64_t arg) {
51915         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
51916         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
51917         return ret_conv;
51918 }
51919
51920 uint64_t  __attribute__((export_name("TS_NetworkUpdate_clone"))) TS_NetworkUpdate_clone(uint64_t orig) {
51921         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
51922         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51923         *ret_copy = NetworkUpdate_clone(orig_conv);
51924         uint64_t ret_ref = tag_ptr(ret_copy, true);
51925         return ret_ref;
51926 }
51927
51928 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_update_message"))) TS_NetworkUpdate_channel_update_message(uint64_t msg) {
51929         LDKChannelUpdate msg_conv;
51930         msg_conv.inner = untag_ptr(msg);
51931         msg_conv.is_owned = ptr_is_owned(msg);
51932         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
51933         msg_conv = ChannelUpdate_clone(&msg_conv);
51934         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51935         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
51936         uint64_t ret_ref = tag_ptr(ret_copy, true);
51937         return ret_ref;
51938 }
51939
51940 uint64_t  __attribute__((export_name("TS_NetworkUpdate_channel_failure"))) TS_NetworkUpdate_channel_failure(int64_t short_channel_id, jboolean is_permanent) {
51941         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51942         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
51943         uint64_t ret_ref = tag_ptr(ret_copy, true);
51944         return ret_ref;
51945 }
51946
51947 uint64_t  __attribute__((export_name("TS_NetworkUpdate_node_failure"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
51948         LDKPublicKey node_id_ref;
51949         CHECK(node_id->arr_len == 33);
51950         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
51951         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
51952         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
51953         uint64_t ret_ref = tag_ptr(ret_copy, true);
51954         return ret_ref;
51955 }
51956
51957 jboolean  __attribute__((export_name("TS_NetworkUpdate_eq"))) TS_NetworkUpdate_eq(uint64_t a, uint64_t b) {
51958         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
51959         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
51960         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
51961         return ret_conv;
51962 }
51963
51964 int8_tArray  __attribute__((export_name("TS_NetworkUpdate_write"))) TS_NetworkUpdate_write(uint64_t obj) {
51965         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
51966         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
51967         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
51968         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
51969         CVec_u8Z_free(ret_var);
51970         return ret_arr;
51971 }
51972
51973 uint64_t  __attribute__((export_name("TS_NetworkUpdate_read"))) TS_NetworkUpdate_read(int8_tArray ser) {
51974         LDKu8slice ser_ref;
51975         ser_ref.datalen = ser->arr_len;
51976         ser_ref.data = ser->elems;
51977         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
51978         *ret_conv = NetworkUpdate_read(ser_ref);
51979         FREE(ser);
51980         return tag_ptr(ret_conv, true);
51981 }
51982
51983 void  __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_free(uint64_t this_obj) {
51984         LDKP2PGossipSync this_obj_conv;
51985         this_obj_conv.inner = untag_ptr(this_obj);
51986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51988         P2PGossipSync_free(this_obj_conv);
51989 }
51990
51991 uint64_t  __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) {
51992         LDKNetworkGraph network_graph_conv;
51993         network_graph_conv.inner = untag_ptr(network_graph);
51994         network_graph_conv.is_owned = ptr_is_owned(network_graph);
51995         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
51996         network_graph_conv.is_owned = false;
51997         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
51998         CHECK_ACCESS(utxo_lookup_ptr);
51999         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
52000         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
52001         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
52002                 // Manually implement clone for Java trait instances
52003                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
52004                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52005                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
52006                 }
52007         }
52008         void* logger_ptr = untag_ptr(logger);
52009         CHECK_ACCESS(logger_ptr);
52010         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
52011         if (logger_conv.free == LDKLogger_JCalls_free) {
52012                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52013                 LDKLogger_JCalls_cloned(&logger_conv);
52014         }
52015         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
52016         uint64_t ret_ref = 0;
52017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52019         return ret_ref;
52020 }
52021
52022 void  __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) {
52023         LDKP2PGossipSync this_arg_conv;
52024         this_arg_conv.inner = untag_ptr(this_arg);
52025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52027         this_arg_conv.is_owned = false;
52028         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
52029         CHECK_ACCESS(utxo_lookup_ptr);
52030         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
52031         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
52032         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
52033                 // Manually implement clone for Java trait instances
52034                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
52035                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
52036                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
52037                 }
52038         }
52039         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
52040 }
52041
52042 void  __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) {
52043         LDKNetworkGraph this_arg_conv;
52044         this_arg_conv.inner = untag_ptr(this_arg);
52045         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52047         this_arg_conv.is_owned = false;
52048         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
52049         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
52050 }
52051
52052 int8_tArray  __attribute__((export_name("TS_NetworkGraph_get_genesis_hash"))) TS_NetworkGraph_get_genesis_hash(uint64_t this_arg) {
52053         LDKNetworkGraph this_arg_conv;
52054         this_arg_conv.inner = untag_ptr(this_arg);
52055         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52056         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52057         this_arg_conv.is_owned = false;
52058         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
52059         memcpy(ret_arr->elems, NetworkGraph_get_genesis_hash(&this_arg_conv).data, 32);
52060         return ret_arr;
52061 }
52062
52063 uint64_t  __attribute__((export_name("TS_verify_node_announcement"))) TS_verify_node_announcement(uint64_t msg) {
52064         LDKNodeAnnouncement msg_conv;
52065         msg_conv.inner = untag_ptr(msg);
52066         msg_conv.is_owned = ptr_is_owned(msg);
52067         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
52068         msg_conv.is_owned = false;
52069         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
52070         *ret_conv = verify_node_announcement(&msg_conv);
52071         return tag_ptr(ret_conv, true);
52072 }
52073
52074 uint64_t  __attribute__((export_name("TS_verify_channel_announcement"))) TS_verify_channel_announcement(uint64_t msg) {
52075         LDKChannelAnnouncement msg_conv;
52076         msg_conv.inner = untag_ptr(msg);
52077         msg_conv.is_owned = ptr_is_owned(msg);
52078         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
52079         msg_conv.is_owned = false;
52080         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
52081         *ret_conv = verify_channel_announcement(&msg_conv);
52082         return tag_ptr(ret_conv, true);
52083 }
52084
52085 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) {
52086         LDKP2PGossipSync this_arg_conv;
52087         this_arg_conv.inner = untag_ptr(this_arg);
52088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52090         this_arg_conv.is_owned = false;
52091         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
52092         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
52093         return tag_ptr(ret_ret, true);
52094 }
52095
52096 uint64_t  __attribute__((export_name("TS_P2PGossipSync_as_MessageSendEventsProvider"))) TS_P2PGossipSync_as_MessageSendEventsProvider(uint64_t this_arg) {
52097         LDKP2PGossipSync this_arg_conv;
52098         this_arg_conv.inner = untag_ptr(this_arg);
52099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52101         this_arg_conv.is_owned = false;
52102         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
52103         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
52104         return tag_ptr(ret_ret, true);
52105 }
52106
52107 void  __attribute__((export_name("TS_ChannelUpdateInfo_free"))) TS_ChannelUpdateInfo_free(uint64_t this_obj) {
52108         LDKChannelUpdateInfo this_obj_conv;
52109         this_obj_conv.inner = untag_ptr(this_obj);
52110         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52112         ChannelUpdateInfo_free(this_obj_conv);
52113 }
52114
52115 int32_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update"))) TS_ChannelUpdateInfo_get_last_update(uint64_t this_ptr) {
52116         LDKChannelUpdateInfo this_ptr_conv;
52117         this_ptr_conv.inner = untag_ptr(this_ptr);
52118         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52120         this_ptr_conv.is_owned = false;
52121         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
52122         return ret_conv;
52123 }
52124
52125 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update"))) TS_ChannelUpdateInfo_set_last_update(uint64_t this_ptr, int32_t val) {
52126         LDKChannelUpdateInfo this_ptr_conv;
52127         this_ptr_conv.inner = untag_ptr(this_ptr);
52128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52130         this_ptr_conv.is_owned = false;
52131         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
52132 }
52133
52134 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_get_enabled"))) TS_ChannelUpdateInfo_get_enabled(uint64_t this_ptr) {
52135         LDKChannelUpdateInfo this_ptr_conv;
52136         this_ptr_conv.inner = untag_ptr(this_ptr);
52137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52139         this_ptr_conv.is_owned = false;
52140         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
52141         return ret_conv;
52142 }
52143
52144 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_enabled"))) TS_ChannelUpdateInfo_set_enabled(uint64_t this_ptr, jboolean val) {
52145         LDKChannelUpdateInfo this_ptr_conv;
52146         this_ptr_conv.inner = untag_ptr(this_ptr);
52147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52149         this_ptr_conv.is_owned = false;
52150         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
52151 }
52152
52153 int16_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_cltv_expiry_delta"))) TS_ChannelUpdateInfo_get_cltv_expiry_delta(uint64_t this_ptr) {
52154         LDKChannelUpdateInfo this_ptr_conv;
52155         this_ptr_conv.inner = untag_ptr(this_ptr);
52156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52158         this_ptr_conv.is_owned = false;
52159         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
52160         return ret_conv;
52161 }
52162
52163 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_cltv_expiry_delta"))) TS_ChannelUpdateInfo_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
52164         LDKChannelUpdateInfo this_ptr_conv;
52165         this_ptr_conv.inner = untag_ptr(this_ptr);
52166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52168         this_ptr_conv.is_owned = false;
52169         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
52170 }
52171
52172 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_minimum_msat"))) TS_ChannelUpdateInfo_get_htlc_minimum_msat(uint64_t this_ptr) {
52173         LDKChannelUpdateInfo this_ptr_conv;
52174         this_ptr_conv.inner = untag_ptr(this_ptr);
52175         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52177         this_ptr_conv.is_owned = false;
52178         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
52179         return ret_conv;
52180 }
52181
52182 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_minimum_msat"))) TS_ChannelUpdateInfo_set_htlc_minimum_msat(uint64_t this_ptr, int64_t val) {
52183         LDKChannelUpdateInfo this_ptr_conv;
52184         this_ptr_conv.inner = untag_ptr(this_ptr);
52185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52187         this_ptr_conv.is_owned = false;
52188         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
52189 }
52190
52191 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_htlc_maximum_msat"))) TS_ChannelUpdateInfo_get_htlc_maximum_msat(uint64_t this_ptr) {
52192         LDKChannelUpdateInfo this_ptr_conv;
52193         this_ptr_conv.inner = untag_ptr(this_ptr);
52194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52196         this_ptr_conv.is_owned = false;
52197         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
52198         return ret_conv;
52199 }
52200
52201 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_htlc_maximum_msat"))) TS_ChannelUpdateInfo_set_htlc_maximum_msat(uint64_t this_ptr, int64_t val) {
52202         LDKChannelUpdateInfo this_ptr_conv;
52203         this_ptr_conv.inner = untag_ptr(this_ptr);
52204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52206         this_ptr_conv.is_owned = false;
52207         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
52208 }
52209
52210 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_fees"))) TS_ChannelUpdateInfo_get_fees(uint64_t this_ptr) {
52211         LDKChannelUpdateInfo this_ptr_conv;
52212         this_ptr_conv.inner = untag_ptr(this_ptr);
52213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52215         this_ptr_conv.is_owned = false;
52216         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
52217         uint64_t ret_ref = 0;
52218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52220         return ret_ref;
52221 }
52222
52223 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_fees"))) TS_ChannelUpdateInfo_set_fees(uint64_t this_ptr, uint64_t val) {
52224         LDKChannelUpdateInfo this_ptr_conv;
52225         this_ptr_conv.inner = untag_ptr(this_ptr);
52226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52228         this_ptr_conv.is_owned = false;
52229         LDKRoutingFees val_conv;
52230         val_conv.inner = untag_ptr(val);
52231         val_conv.is_owned = ptr_is_owned(val);
52232         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52233         val_conv = RoutingFees_clone(&val_conv);
52234         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
52235 }
52236
52237 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_get_last_update_message"))) TS_ChannelUpdateInfo_get_last_update_message(uint64_t this_ptr) {
52238         LDKChannelUpdateInfo this_ptr_conv;
52239         this_ptr_conv.inner = untag_ptr(this_ptr);
52240         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52242         this_ptr_conv.is_owned = false;
52243         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
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 void  __attribute__((export_name("TS_ChannelUpdateInfo_set_last_update_message"))) TS_ChannelUpdateInfo_set_last_update_message(uint64_t this_ptr, uint64_t val) {
52251         LDKChannelUpdateInfo this_ptr_conv;
52252         this_ptr_conv.inner = untag_ptr(this_ptr);
52253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52255         this_ptr_conv.is_owned = false;
52256         LDKChannelUpdate val_conv;
52257         val_conv.inner = untag_ptr(val);
52258         val_conv.is_owned = ptr_is_owned(val);
52259         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52260         val_conv = ChannelUpdate_clone(&val_conv);
52261         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
52262 }
52263
52264 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) {
52265         LDKRoutingFees fees_arg_conv;
52266         fees_arg_conv.inner = untag_ptr(fees_arg);
52267         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
52268         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
52269         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
52270         LDKChannelUpdate last_update_message_arg_conv;
52271         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
52272         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
52273         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
52274         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
52275         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);
52276         uint64_t ret_ref = 0;
52277         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52278         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52279         return ret_ref;
52280 }
52281
52282 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
52283         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
52284         uint64_t ret_ref = 0;
52285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52287         return ret_ref;
52288 }
52289 int64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone_ptr"))) TS_ChannelUpdateInfo_clone_ptr(uint64_t arg) {
52290         LDKChannelUpdateInfo arg_conv;
52291         arg_conv.inner = untag_ptr(arg);
52292         arg_conv.is_owned = ptr_is_owned(arg);
52293         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52294         arg_conv.is_owned = false;
52295         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
52296         return ret_conv;
52297 }
52298
52299 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_clone"))) TS_ChannelUpdateInfo_clone(uint64_t orig) {
52300         LDKChannelUpdateInfo orig_conv;
52301         orig_conv.inner = untag_ptr(orig);
52302         orig_conv.is_owned = ptr_is_owned(orig);
52303         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52304         orig_conv.is_owned = false;
52305         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
52306         uint64_t ret_ref = 0;
52307         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52308         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52309         return ret_ref;
52310 }
52311
52312 jboolean  __attribute__((export_name("TS_ChannelUpdateInfo_eq"))) TS_ChannelUpdateInfo_eq(uint64_t a, uint64_t b) {
52313         LDKChannelUpdateInfo a_conv;
52314         a_conv.inner = untag_ptr(a);
52315         a_conv.is_owned = ptr_is_owned(a);
52316         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52317         a_conv.is_owned = false;
52318         LDKChannelUpdateInfo b_conv;
52319         b_conv.inner = untag_ptr(b);
52320         b_conv.is_owned = ptr_is_owned(b);
52321         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52322         b_conv.is_owned = false;
52323         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
52324         return ret_conv;
52325 }
52326
52327 int8_tArray  __attribute__((export_name("TS_ChannelUpdateInfo_write"))) TS_ChannelUpdateInfo_write(uint64_t obj) {
52328         LDKChannelUpdateInfo obj_conv;
52329         obj_conv.inner = untag_ptr(obj);
52330         obj_conv.is_owned = ptr_is_owned(obj);
52331         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52332         obj_conv.is_owned = false;
52333         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
52334         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52335         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52336         CVec_u8Z_free(ret_var);
52337         return ret_arr;
52338 }
52339
52340 uint64_t  __attribute__((export_name("TS_ChannelUpdateInfo_read"))) TS_ChannelUpdateInfo_read(int8_tArray ser) {
52341         LDKu8slice ser_ref;
52342         ser_ref.datalen = ser->arr_len;
52343         ser_ref.data = ser->elems;
52344         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
52345         *ret_conv = ChannelUpdateInfo_read(ser_ref);
52346         FREE(ser);
52347         return tag_ptr(ret_conv, true);
52348 }
52349
52350 void  __attribute__((export_name("TS_ChannelInfo_free"))) TS_ChannelInfo_free(uint64_t this_obj) {
52351         LDKChannelInfo this_obj_conv;
52352         this_obj_conv.inner = untag_ptr(this_obj);
52353         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52355         ChannelInfo_free(this_obj_conv);
52356 }
52357
52358 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_features"))) TS_ChannelInfo_get_features(uint64_t this_ptr) {
52359         LDKChannelInfo this_ptr_conv;
52360         this_ptr_conv.inner = untag_ptr(this_ptr);
52361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52363         this_ptr_conv.is_owned = false;
52364         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
52365         uint64_t ret_ref = 0;
52366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52368         return ret_ref;
52369 }
52370
52371 void  __attribute__((export_name("TS_ChannelInfo_set_features"))) TS_ChannelInfo_set_features(uint64_t this_ptr, uint64_t val) {
52372         LDKChannelInfo this_ptr_conv;
52373         this_ptr_conv.inner = untag_ptr(this_ptr);
52374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52376         this_ptr_conv.is_owned = false;
52377         LDKChannelFeatures val_conv;
52378         val_conv.inner = untag_ptr(val);
52379         val_conv.is_owned = ptr_is_owned(val);
52380         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52381         val_conv = ChannelFeatures_clone(&val_conv);
52382         ChannelInfo_set_features(&this_ptr_conv, val_conv);
52383 }
52384
52385 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_one"))) TS_ChannelInfo_get_node_one(uint64_t this_ptr) {
52386         LDKChannelInfo this_ptr_conv;
52387         this_ptr_conv.inner = untag_ptr(this_ptr);
52388         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52390         this_ptr_conv.is_owned = false;
52391         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
52392         uint64_t ret_ref = 0;
52393         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52394         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52395         return ret_ref;
52396 }
52397
52398 void  __attribute__((export_name("TS_ChannelInfo_set_node_one"))) TS_ChannelInfo_set_node_one(uint64_t this_ptr, uint64_t val) {
52399         LDKChannelInfo this_ptr_conv;
52400         this_ptr_conv.inner = untag_ptr(this_ptr);
52401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52403         this_ptr_conv.is_owned = false;
52404         LDKNodeId val_conv;
52405         val_conv.inner = untag_ptr(val);
52406         val_conv.is_owned = ptr_is_owned(val);
52407         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52408         val_conv = NodeId_clone(&val_conv);
52409         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
52410 }
52411
52412 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_one_to_two"))) TS_ChannelInfo_get_one_to_two(uint64_t this_ptr) {
52413         LDKChannelInfo this_ptr_conv;
52414         this_ptr_conv.inner = untag_ptr(this_ptr);
52415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52417         this_ptr_conv.is_owned = false;
52418         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
52419         uint64_t ret_ref = 0;
52420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52422         return ret_ref;
52423 }
52424
52425 void  __attribute__((export_name("TS_ChannelInfo_set_one_to_two"))) TS_ChannelInfo_set_one_to_two(uint64_t this_ptr, uint64_t val) {
52426         LDKChannelInfo this_ptr_conv;
52427         this_ptr_conv.inner = untag_ptr(this_ptr);
52428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52430         this_ptr_conv.is_owned = false;
52431         LDKChannelUpdateInfo val_conv;
52432         val_conv.inner = untag_ptr(val);
52433         val_conv.is_owned = ptr_is_owned(val);
52434         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52435         val_conv = ChannelUpdateInfo_clone(&val_conv);
52436         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
52437 }
52438
52439 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_node_two"))) TS_ChannelInfo_get_node_two(uint64_t this_ptr) {
52440         LDKChannelInfo this_ptr_conv;
52441         this_ptr_conv.inner = untag_ptr(this_ptr);
52442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52444         this_ptr_conv.is_owned = false;
52445         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
52446         uint64_t ret_ref = 0;
52447         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52448         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52449         return ret_ref;
52450 }
52451
52452 void  __attribute__((export_name("TS_ChannelInfo_set_node_two"))) TS_ChannelInfo_set_node_two(uint64_t this_ptr, uint64_t val) {
52453         LDKChannelInfo this_ptr_conv;
52454         this_ptr_conv.inner = untag_ptr(this_ptr);
52455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52457         this_ptr_conv.is_owned = false;
52458         LDKNodeId val_conv;
52459         val_conv.inner = untag_ptr(val);
52460         val_conv.is_owned = ptr_is_owned(val);
52461         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52462         val_conv = NodeId_clone(&val_conv);
52463         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
52464 }
52465
52466 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_two_to_one"))) TS_ChannelInfo_get_two_to_one(uint64_t this_ptr) {
52467         LDKChannelInfo this_ptr_conv;
52468         this_ptr_conv.inner = untag_ptr(this_ptr);
52469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52471         this_ptr_conv.is_owned = false;
52472         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
52473         uint64_t ret_ref = 0;
52474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52476         return ret_ref;
52477 }
52478
52479 void  __attribute__((export_name("TS_ChannelInfo_set_two_to_one"))) TS_ChannelInfo_set_two_to_one(uint64_t this_ptr, uint64_t val) {
52480         LDKChannelInfo this_ptr_conv;
52481         this_ptr_conv.inner = untag_ptr(this_ptr);
52482         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52484         this_ptr_conv.is_owned = false;
52485         LDKChannelUpdateInfo val_conv;
52486         val_conv.inner = untag_ptr(val);
52487         val_conv.is_owned = ptr_is_owned(val);
52488         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52489         val_conv = ChannelUpdateInfo_clone(&val_conv);
52490         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
52491 }
52492
52493 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_capacity_sats"))) TS_ChannelInfo_get_capacity_sats(uint64_t this_ptr) {
52494         LDKChannelInfo this_ptr_conv;
52495         this_ptr_conv.inner = untag_ptr(this_ptr);
52496         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52498         this_ptr_conv.is_owned = false;
52499         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
52500         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
52501         uint64_t ret_ref = tag_ptr(ret_copy, true);
52502         return ret_ref;
52503 }
52504
52505 void  __attribute__((export_name("TS_ChannelInfo_set_capacity_sats"))) TS_ChannelInfo_set_capacity_sats(uint64_t this_ptr, uint64_t val) {
52506         LDKChannelInfo this_ptr_conv;
52507         this_ptr_conv.inner = untag_ptr(this_ptr);
52508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52510         this_ptr_conv.is_owned = false;
52511         void* val_ptr = untag_ptr(val);
52512         CHECK_ACCESS(val_ptr);
52513         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
52514         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
52515         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
52516 }
52517
52518 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_announcement_message"))) TS_ChannelInfo_get_announcement_message(uint64_t this_ptr) {
52519         LDKChannelInfo this_ptr_conv;
52520         this_ptr_conv.inner = untag_ptr(this_ptr);
52521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52523         this_ptr_conv.is_owned = false;
52524         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
52525         uint64_t ret_ref = 0;
52526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52528         return ret_ref;
52529 }
52530
52531 void  __attribute__((export_name("TS_ChannelInfo_set_announcement_message"))) TS_ChannelInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
52532         LDKChannelInfo this_ptr_conv;
52533         this_ptr_conv.inner = untag_ptr(this_ptr);
52534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52536         this_ptr_conv.is_owned = false;
52537         LDKChannelAnnouncement val_conv;
52538         val_conv.inner = untag_ptr(val);
52539         val_conv.is_owned = ptr_is_owned(val);
52540         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52541         val_conv = ChannelAnnouncement_clone(&val_conv);
52542         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
52543 }
52544
52545 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
52546         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
52547         uint64_t ret_ref = 0;
52548         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52549         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52550         return ret_ref;
52551 }
52552 int64_t  __attribute__((export_name("TS_ChannelInfo_clone_ptr"))) TS_ChannelInfo_clone_ptr(uint64_t arg) {
52553         LDKChannelInfo arg_conv;
52554         arg_conv.inner = untag_ptr(arg);
52555         arg_conv.is_owned = ptr_is_owned(arg);
52556         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52557         arg_conv.is_owned = false;
52558         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
52559         return ret_conv;
52560 }
52561
52562 uint64_t  __attribute__((export_name("TS_ChannelInfo_clone"))) TS_ChannelInfo_clone(uint64_t orig) {
52563         LDKChannelInfo orig_conv;
52564         orig_conv.inner = untag_ptr(orig);
52565         orig_conv.is_owned = ptr_is_owned(orig);
52566         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52567         orig_conv.is_owned = false;
52568         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
52569         uint64_t ret_ref = 0;
52570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52572         return ret_ref;
52573 }
52574
52575 jboolean  __attribute__((export_name("TS_ChannelInfo_eq"))) TS_ChannelInfo_eq(uint64_t a, uint64_t b) {
52576         LDKChannelInfo a_conv;
52577         a_conv.inner = untag_ptr(a);
52578         a_conv.is_owned = ptr_is_owned(a);
52579         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52580         a_conv.is_owned = false;
52581         LDKChannelInfo b_conv;
52582         b_conv.inner = untag_ptr(b);
52583         b_conv.is_owned = ptr_is_owned(b);
52584         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52585         b_conv.is_owned = false;
52586         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
52587         return ret_conv;
52588 }
52589
52590 uint64_t  __attribute__((export_name("TS_ChannelInfo_get_directional_info"))) TS_ChannelInfo_get_directional_info(uint64_t this_arg, int8_t channel_flags) {
52591         LDKChannelInfo this_arg_conv;
52592         this_arg_conv.inner = untag_ptr(this_arg);
52593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52595         this_arg_conv.is_owned = false;
52596         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
52597         uint64_t ret_ref = 0;
52598         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52599         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52600         return ret_ref;
52601 }
52602
52603 int8_tArray  __attribute__((export_name("TS_ChannelInfo_write"))) TS_ChannelInfo_write(uint64_t obj) {
52604         LDKChannelInfo obj_conv;
52605         obj_conv.inner = untag_ptr(obj);
52606         obj_conv.is_owned = ptr_is_owned(obj);
52607         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52608         obj_conv.is_owned = false;
52609         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
52610         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52611         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52612         CVec_u8Z_free(ret_var);
52613         return ret_arr;
52614 }
52615
52616 uint64_t  __attribute__((export_name("TS_ChannelInfo_read"))) TS_ChannelInfo_read(int8_tArray ser) {
52617         LDKu8slice ser_ref;
52618         ser_ref.datalen = ser->arr_len;
52619         ser_ref.data = ser->elems;
52620         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
52621         *ret_conv = ChannelInfo_read(ser_ref);
52622         FREE(ser);
52623         return tag_ptr(ret_conv, true);
52624 }
52625
52626 void  __attribute__((export_name("TS_DirectedChannelInfo_free"))) TS_DirectedChannelInfo_free(uint64_t this_obj) {
52627         LDKDirectedChannelInfo this_obj_conv;
52628         this_obj_conv.inner = untag_ptr(this_obj);
52629         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52631         DirectedChannelInfo_free(this_obj_conv);
52632 }
52633
52634 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
52635         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
52636         uint64_t ret_ref = 0;
52637         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52638         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52639         return ret_ref;
52640 }
52641 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone_ptr"))) TS_DirectedChannelInfo_clone_ptr(uint64_t arg) {
52642         LDKDirectedChannelInfo arg_conv;
52643         arg_conv.inner = untag_ptr(arg);
52644         arg_conv.is_owned = ptr_is_owned(arg);
52645         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52646         arg_conv.is_owned = false;
52647         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
52648         return ret_conv;
52649 }
52650
52651 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_clone"))) TS_DirectedChannelInfo_clone(uint64_t orig) {
52652         LDKDirectedChannelInfo orig_conv;
52653         orig_conv.inner = untag_ptr(orig);
52654         orig_conv.is_owned = ptr_is_owned(orig);
52655         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52656         orig_conv.is_owned = false;
52657         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
52658         uint64_t ret_ref = 0;
52659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52661         return ret_ref;
52662 }
52663
52664 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_DirectedChannelInfo_channel(uint64_t this_arg) {
52665         LDKDirectedChannelInfo this_arg_conv;
52666         this_arg_conv.inner = untag_ptr(this_arg);
52667         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52669         this_arg_conv.is_owned = false;
52670         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
52671         uint64_t ret_ref = 0;
52672         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52673         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52674         return ret_ref;
52675 }
52676
52677 int64_t  __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) {
52678         LDKDirectedChannelInfo this_arg_conv;
52679         this_arg_conv.inner = untag_ptr(this_arg);
52680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52682         this_arg_conv.is_owned = false;
52683         int64_t ret_conv = DirectedChannelInfo_htlc_maximum_msat(&this_arg_conv);
52684         return ret_conv;
52685 }
52686
52687 uint64_t  __attribute__((export_name("TS_DirectedChannelInfo_effective_capacity"))) TS_DirectedChannelInfo_effective_capacity(uint64_t this_arg) {
52688         LDKDirectedChannelInfo this_arg_conv;
52689         this_arg_conv.inner = untag_ptr(this_arg);
52690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
52691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
52692         this_arg_conv.is_owned = false;
52693         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52694         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
52695         uint64_t ret_ref = tag_ptr(ret_copy, true);
52696         return ret_ref;
52697 }
52698
52699 void  __attribute__((export_name("TS_EffectiveCapacity_free"))) TS_EffectiveCapacity_free(uint64_t this_ptr) {
52700         if (!ptr_is_owned(this_ptr)) return;
52701         void* this_ptr_ptr = untag_ptr(this_ptr);
52702         CHECK_ACCESS(this_ptr_ptr);
52703         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
52704         FREE(untag_ptr(this_ptr));
52705         EffectiveCapacity_free(this_ptr_conv);
52706 }
52707
52708 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
52709         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52710         *ret_copy = EffectiveCapacity_clone(arg);
52711         uint64_t ret_ref = tag_ptr(ret_copy, true);
52712         return ret_ref;
52713 }
52714 int64_t  __attribute__((export_name("TS_EffectiveCapacity_clone_ptr"))) TS_EffectiveCapacity_clone_ptr(uint64_t arg) {
52715         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
52716         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
52717         return ret_conv;
52718 }
52719
52720 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_clone"))) TS_EffectiveCapacity_clone(uint64_t orig) {
52721         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
52722         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52723         *ret_copy = EffectiveCapacity_clone(orig_conv);
52724         uint64_t ret_ref = tag_ptr(ret_copy, true);
52725         return ret_ref;
52726 }
52727
52728 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_exact_liquidity"))) TS_EffectiveCapacity_exact_liquidity(int64_t liquidity_msat) {
52729         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52730         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
52731         uint64_t ret_ref = tag_ptr(ret_copy, true);
52732         return ret_ref;
52733 }
52734
52735 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_advertised_max_htlc"))) TS_EffectiveCapacity_advertised_max_htlc(int64_t amount_msat) {
52736         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52737         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
52738         uint64_t ret_ref = tag_ptr(ret_copy, true);
52739         return ret_ref;
52740 }
52741
52742 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) {
52743         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52744         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
52745         uint64_t ret_ref = tag_ptr(ret_copy, true);
52746         return ret_ref;
52747 }
52748
52749 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_infinite"))) TS_EffectiveCapacity_infinite() {
52750         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52751         *ret_copy = EffectiveCapacity_infinite();
52752         uint64_t ret_ref = tag_ptr(ret_copy, true);
52753         return ret_ref;
52754 }
52755
52756 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_hint_max_htlc"))) TS_EffectiveCapacity_hint_max_htlc(int64_t amount_msat) {
52757         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52758         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
52759         uint64_t ret_ref = tag_ptr(ret_copy, true);
52760         return ret_ref;
52761 }
52762
52763 uint64_t  __attribute__((export_name("TS_EffectiveCapacity_unknown"))) TS_EffectiveCapacity_unknown() {
52764         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
52765         *ret_copy = EffectiveCapacity_unknown();
52766         uint64_t ret_ref = tag_ptr(ret_copy, true);
52767         return ret_ref;
52768 }
52769
52770 int64_t  __attribute__((export_name("TS_EffectiveCapacity_as_msat"))) TS_EffectiveCapacity_as_msat(uint64_t this_arg) {
52771         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
52772         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
52773         return ret_conv;
52774 }
52775
52776 void  __attribute__((export_name("TS_RoutingFees_free"))) TS_RoutingFees_free(uint64_t this_obj) {
52777         LDKRoutingFees this_obj_conv;
52778         this_obj_conv.inner = untag_ptr(this_obj);
52779         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52781         RoutingFees_free(this_obj_conv);
52782 }
52783
52784 int32_t  __attribute__((export_name("TS_RoutingFees_get_base_msat"))) TS_RoutingFees_get_base_msat(uint64_t this_ptr) {
52785         LDKRoutingFees this_ptr_conv;
52786         this_ptr_conv.inner = untag_ptr(this_ptr);
52787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52789         this_ptr_conv.is_owned = false;
52790         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
52791         return ret_conv;
52792 }
52793
52794 void  __attribute__((export_name("TS_RoutingFees_set_base_msat"))) TS_RoutingFees_set_base_msat(uint64_t this_ptr, int32_t val) {
52795         LDKRoutingFees this_ptr_conv;
52796         this_ptr_conv.inner = untag_ptr(this_ptr);
52797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52799         this_ptr_conv.is_owned = false;
52800         RoutingFees_set_base_msat(&this_ptr_conv, val);
52801 }
52802
52803 int32_t  __attribute__((export_name("TS_RoutingFees_get_proportional_millionths"))) TS_RoutingFees_get_proportional_millionths(uint64_t this_ptr) {
52804         LDKRoutingFees this_ptr_conv;
52805         this_ptr_conv.inner = untag_ptr(this_ptr);
52806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52808         this_ptr_conv.is_owned = false;
52809         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
52810         return ret_conv;
52811 }
52812
52813 void  __attribute__((export_name("TS_RoutingFees_set_proportional_millionths"))) TS_RoutingFees_set_proportional_millionths(uint64_t this_ptr, int32_t val) {
52814         LDKRoutingFees this_ptr_conv;
52815         this_ptr_conv.inner = untag_ptr(this_ptr);
52816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52818         this_ptr_conv.is_owned = false;
52819         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
52820 }
52821
52822 uint64_t  __attribute__((export_name("TS_RoutingFees_new"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) {
52823         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
52824         uint64_t ret_ref = 0;
52825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52827         return ret_ref;
52828 }
52829
52830 jboolean  __attribute__((export_name("TS_RoutingFees_eq"))) TS_RoutingFees_eq(uint64_t a, uint64_t b) {
52831         LDKRoutingFees a_conv;
52832         a_conv.inner = untag_ptr(a);
52833         a_conv.is_owned = ptr_is_owned(a);
52834         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52835         a_conv.is_owned = false;
52836         LDKRoutingFees b_conv;
52837         b_conv.inner = untag_ptr(b);
52838         b_conv.is_owned = ptr_is_owned(b);
52839         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52840         b_conv.is_owned = false;
52841         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
52842         return ret_conv;
52843 }
52844
52845 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
52846         LDKRoutingFees ret_var = RoutingFees_clone(arg);
52847         uint64_t ret_ref = 0;
52848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52850         return ret_ref;
52851 }
52852 int64_t  __attribute__((export_name("TS_RoutingFees_clone_ptr"))) TS_RoutingFees_clone_ptr(uint64_t arg) {
52853         LDKRoutingFees arg_conv;
52854         arg_conv.inner = untag_ptr(arg);
52855         arg_conv.is_owned = ptr_is_owned(arg);
52856         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52857         arg_conv.is_owned = false;
52858         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
52859         return ret_conv;
52860 }
52861
52862 uint64_t  __attribute__((export_name("TS_RoutingFees_clone"))) TS_RoutingFees_clone(uint64_t orig) {
52863         LDKRoutingFees orig_conv;
52864         orig_conv.inner = untag_ptr(orig);
52865         orig_conv.is_owned = ptr_is_owned(orig);
52866         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52867         orig_conv.is_owned = false;
52868         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
52869         uint64_t ret_ref = 0;
52870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52872         return ret_ref;
52873 }
52874
52875 int64_t  __attribute__((export_name("TS_RoutingFees_hash"))) TS_RoutingFees_hash(uint64_t o) {
52876         LDKRoutingFees o_conv;
52877         o_conv.inner = untag_ptr(o);
52878         o_conv.is_owned = ptr_is_owned(o);
52879         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52880         o_conv.is_owned = false;
52881         int64_t ret_conv = RoutingFees_hash(&o_conv);
52882         return ret_conv;
52883 }
52884
52885 int8_tArray  __attribute__((export_name("TS_RoutingFees_write"))) TS_RoutingFees_write(uint64_t obj) {
52886         LDKRoutingFees obj_conv;
52887         obj_conv.inner = untag_ptr(obj);
52888         obj_conv.is_owned = ptr_is_owned(obj);
52889         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
52890         obj_conv.is_owned = false;
52891         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
52892         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
52893         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
52894         CVec_u8Z_free(ret_var);
52895         return ret_arr;
52896 }
52897
52898 uint64_t  __attribute__((export_name("TS_RoutingFees_read"))) TS_RoutingFees_read(int8_tArray ser) {
52899         LDKu8slice ser_ref;
52900         ser_ref.datalen = ser->arr_len;
52901         ser_ref.data = ser->elems;
52902         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
52903         *ret_conv = RoutingFees_read(ser_ref);
52904         FREE(ser);
52905         return tag_ptr(ret_conv, true);
52906 }
52907
52908 void  __attribute__((export_name("TS_NodeAnnouncementInfo_free"))) TS_NodeAnnouncementInfo_free(uint64_t this_obj) {
52909         LDKNodeAnnouncementInfo this_obj_conv;
52910         this_obj_conv.inner = untag_ptr(this_obj);
52911         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52913         NodeAnnouncementInfo_free(this_obj_conv);
52914 }
52915
52916 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_features"))) TS_NodeAnnouncementInfo_get_features(uint64_t this_ptr) {
52917         LDKNodeAnnouncementInfo this_ptr_conv;
52918         this_ptr_conv.inner = untag_ptr(this_ptr);
52919         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52921         this_ptr_conv.is_owned = false;
52922         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
52923         uint64_t ret_ref = 0;
52924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52926         return ret_ref;
52927 }
52928
52929 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_features"))) TS_NodeAnnouncementInfo_set_features(uint64_t this_ptr, uint64_t val) {
52930         LDKNodeAnnouncementInfo this_ptr_conv;
52931         this_ptr_conv.inner = untag_ptr(this_ptr);
52932         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52934         this_ptr_conv.is_owned = false;
52935         LDKNodeFeatures val_conv;
52936         val_conv.inner = untag_ptr(val);
52937         val_conv.is_owned = ptr_is_owned(val);
52938         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52939         val_conv = NodeFeatures_clone(&val_conv);
52940         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
52941 }
52942
52943 int32_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_last_update"))) TS_NodeAnnouncementInfo_get_last_update(uint64_t this_ptr) {
52944         LDKNodeAnnouncementInfo this_ptr_conv;
52945         this_ptr_conv.inner = untag_ptr(this_ptr);
52946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52948         this_ptr_conv.is_owned = false;
52949         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
52950         return ret_conv;
52951 }
52952
52953 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_last_update"))) TS_NodeAnnouncementInfo_set_last_update(uint64_t this_ptr, int32_t val) {
52954         LDKNodeAnnouncementInfo this_ptr_conv;
52955         this_ptr_conv.inner = untag_ptr(this_ptr);
52956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52958         this_ptr_conv.is_owned = false;
52959         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
52960 }
52961
52962 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_get_rgb"))) TS_NodeAnnouncementInfo_get_rgb(uint64_t this_ptr) {
52963         LDKNodeAnnouncementInfo this_ptr_conv;
52964         this_ptr_conv.inner = untag_ptr(this_ptr);
52965         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52967         this_ptr_conv.is_owned = false;
52968         int8_tArray ret_arr = init_int8_tArray(3, __LINE__);
52969         memcpy(ret_arr->elems, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3);
52970         return ret_arr;
52971 }
52972
52973 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_rgb"))) TS_NodeAnnouncementInfo_set_rgb(uint64_t this_ptr, int8_tArray val) {
52974         LDKNodeAnnouncementInfo this_ptr_conv;
52975         this_ptr_conv.inner = untag_ptr(this_ptr);
52976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52978         this_ptr_conv.is_owned = false;
52979         LDKThreeBytes val_ref;
52980         CHECK(val->arr_len == 3);
52981         memcpy(val_ref.data, val->elems, 3); FREE(val);
52982         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
52983 }
52984
52985 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_alias"))) TS_NodeAnnouncementInfo_get_alias(uint64_t this_ptr) {
52986         LDKNodeAnnouncementInfo this_ptr_conv;
52987         this_ptr_conv.inner = untag_ptr(this_ptr);
52988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52990         this_ptr_conv.is_owned = false;
52991         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
52992         uint64_t ret_ref = 0;
52993         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52994         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52995         return ret_ref;
52996 }
52997
52998 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_alias"))) TS_NodeAnnouncementInfo_set_alias(uint64_t this_ptr, uint64_t val) {
52999         LDKNodeAnnouncementInfo this_ptr_conv;
53000         this_ptr_conv.inner = untag_ptr(this_ptr);
53001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53003         this_ptr_conv.is_owned = false;
53004         LDKNodeAlias val_conv;
53005         val_conv.inner = untag_ptr(val);
53006         val_conv.is_owned = ptr_is_owned(val);
53007         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53008         val_conv = NodeAlias_clone(&val_conv);
53009         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
53010 }
53011
53012 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_get_announcement_message"))) TS_NodeAnnouncementInfo_get_announcement_message(uint64_t this_ptr) {
53013         LDKNodeAnnouncementInfo this_ptr_conv;
53014         this_ptr_conv.inner = untag_ptr(this_ptr);
53015         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53016         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53017         this_ptr_conv.is_owned = false;
53018         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
53019         uint64_t ret_ref = 0;
53020         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53021         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53022         return ret_ref;
53023 }
53024
53025 void  __attribute__((export_name("TS_NodeAnnouncementInfo_set_announcement_message"))) TS_NodeAnnouncementInfo_set_announcement_message(uint64_t this_ptr, uint64_t val) {
53026         LDKNodeAnnouncementInfo this_ptr_conv;
53027         this_ptr_conv.inner = untag_ptr(this_ptr);
53028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53030         this_ptr_conv.is_owned = false;
53031         LDKNodeAnnouncement val_conv;
53032         val_conv.inner = untag_ptr(val);
53033         val_conv.is_owned = ptr_is_owned(val);
53034         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53035         val_conv = NodeAnnouncement_clone(&val_conv);
53036         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
53037 }
53038
53039 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) {
53040         LDKNodeFeatures features_arg_conv;
53041         features_arg_conv.inner = untag_ptr(features_arg);
53042         features_arg_conv.is_owned = ptr_is_owned(features_arg);
53043         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
53044         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
53045         LDKThreeBytes rgb_arg_ref;
53046         CHECK(rgb_arg->arr_len == 3);
53047         memcpy(rgb_arg_ref.data, rgb_arg->elems, 3); FREE(rgb_arg);
53048         LDKNodeAlias alias_arg_conv;
53049         alias_arg_conv.inner = untag_ptr(alias_arg);
53050         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
53051         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
53052         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
53053         LDKNodeAnnouncement announcement_message_arg_conv;
53054         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
53055         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
53056         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
53057         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
53058         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
53059         uint64_t ret_ref = 0;
53060         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53061         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53062         return ret_ref;
53063 }
53064
53065 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
53066         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
53067         uint64_t ret_ref = 0;
53068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53070         return ret_ref;
53071 }
53072 int64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone_ptr"))) TS_NodeAnnouncementInfo_clone_ptr(uint64_t arg) {
53073         LDKNodeAnnouncementInfo arg_conv;
53074         arg_conv.inner = untag_ptr(arg);
53075         arg_conv.is_owned = ptr_is_owned(arg);
53076         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53077         arg_conv.is_owned = false;
53078         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
53079         return ret_conv;
53080 }
53081
53082 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_clone"))) TS_NodeAnnouncementInfo_clone(uint64_t orig) {
53083         LDKNodeAnnouncementInfo orig_conv;
53084         orig_conv.inner = untag_ptr(orig);
53085         orig_conv.is_owned = ptr_is_owned(orig);
53086         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53087         orig_conv.is_owned = false;
53088         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
53089         uint64_t ret_ref = 0;
53090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53092         return ret_ref;
53093 }
53094
53095 jboolean  __attribute__((export_name("TS_NodeAnnouncementInfo_eq"))) TS_NodeAnnouncementInfo_eq(uint64_t a, uint64_t b) {
53096         LDKNodeAnnouncementInfo a_conv;
53097         a_conv.inner = untag_ptr(a);
53098         a_conv.is_owned = ptr_is_owned(a);
53099         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53100         a_conv.is_owned = false;
53101         LDKNodeAnnouncementInfo b_conv;
53102         b_conv.inner = untag_ptr(b);
53103         b_conv.is_owned = ptr_is_owned(b);
53104         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53105         b_conv.is_owned = false;
53106         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
53107         return ret_conv;
53108 }
53109
53110 uint64_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_addresses"))) TS_NodeAnnouncementInfo_addresses(uint64_t this_arg) {
53111         LDKNodeAnnouncementInfo this_arg_conv;
53112         this_arg_conv.inner = untag_ptr(this_arg);
53113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53115         this_arg_conv.is_owned = false;
53116         LDKCVec_NetAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
53117         uint64_tArray ret_arr = NULL;
53118         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53119         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53120         for (size_t m = 0; m < ret_var.datalen; m++) {
53121                 LDKNetAddress *ret_conv_12_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
53122                 *ret_conv_12_copy = ret_var.data[m];
53123                 uint64_t ret_conv_12_ref = tag_ptr(ret_conv_12_copy, true);
53124                 ret_arr_ptr[m] = ret_conv_12_ref;
53125         }
53126         
53127         FREE(ret_var.data);
53128         return ret_arr;
53129 }
53130
53131 int8_tArray  __attribute__((export_name("TS_NodeAnnouncementInfo_write"))) TS_NodeAnnouncementInfo_write(uint64_t obj) {
53132         LDKNodeAnnouncementInfo obj_conv;
53133         obj_conv.inner = untag_ptr(obj);
53134         obj_conv.is_owned = ptr_is_owned(obj);
53135         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53136         obj_conv.is_owned = false;
53137         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
53138         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53139         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53140         CVec_u8Z_free(ret_var);
53141         return ret_arr;
53142 }
53143
53144 uint64_t  __attribute__((export_name("TS_NodeAnnouncementInfo_read"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) {
53145         LDKu8slice ser_ref;
53146         ser_ref.datalen = ser->arr_len;
53147         ser_ref.data = ser->elems;
53148         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
53149         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
53150         FREE(ser);
53151         return tag_ptr(ret_conv, true);
53152 }
53153
53154 void  __attribute__((export_name("TS_NodeAlias_free"))) TS_NodeAlias_free(uint64_t this_obj) {
53155         LDKNodeAlias 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         NodeAlias_free(this_obj_conv);
53160 }
53161
53162 int8_tArray  __attribute__((export_name("TS_NodeAlias_get_a"))) TS_NodeAlias_get_a(uint64_t this_ptr) {
53163         LDKNodeAlias this_ptr_conv;
53164         this_ptr_conv.inner = untag_ptr(this_ptr);
53165         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53167         this_ptr_conv.is_owned = false;
53168         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
53169         memcpy(ret_arr->elems, *NodeAlias_get_a(&this_ptr_conv), 32);
53170         return ret_arr;
53171 }
53172
53173 void  __attribute__((export_name("TS_NodeAlias_set_a"))) TS_NodeAlias_set_a(uint64_t this_ptr, int8_tArray val) {
53174         LDKNodeAlias this_ptr_conv;
53175         this_ptr_conv.inner = untag_ptr(this_ptr);
53176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53178         this_ptr_conv.is_owned = false;
53179         LDKThirtyTwoBytes val_ref;
53180         CHECK(val->arr_len == 32);
53181         memcpy(val_ref.data, val->elems, 32); FREE(val);
53182         NodeAlias_set_a(&this_ptr_conv, val_ref);
53183 }
53184
53185 uint64_t  __attribute__((export_name("TS_NodeAlias_new"))) TS_NodeAlias_new(int8_tArray a_arg) {
53186         LDKThirtyTwoBytes a_arg_ref;
53187         CHECK(a_arg->arr_len == 32);
53188         memcpy(a_arg_ref.data, a_arg->elems, 32); FREE(a_arg);
53189         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
53190         uint64_t ret_ref = 0;
53191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53193         return ret_ref;
53194 }
53195
53196 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
53197         LDKNodeAlias ret_var = NodeAlias_clone(arg);
53198         uint64_t ret_ref = 0;
53199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53201         return ret_ref;
53202 }
53203 int64_t  __attribute__((export_name("TS_NodeAlias_clone_ptr"))) TS_NodeAlias_clone_ptr(uint64_t arg) {
53204         LDKNodeAlias arg_conv;
53205         arg_conv.inner = untag_ptr(arg);
53206         arg_conv.is_owned = ptr_is_owned(arg);
53207         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53208         arg_conv.is_owned = false;
53209         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
53210         return ret_conv;
53211 }
53212
53213 uint64_t  __attribute__((export_name("TS_NodeAlias_clone"))) TS_NodeAlias_clone(uint64_t orig) {
53214         LDKNodeAlias orig_conv;
53215         orig_conv.inner = untag_ptr(orig);
53216         orig_conv.is_owned = ptr_is_owned(orig);
53217         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53218         orig_conv.is_owned = false;
53219         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
53220         uint64_t ret_ref = 0;
53221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53223         return ret_ref;
53224 }
53225
53226 jboolean  __attribute__((export_name("TS_NodeAlias_eq"))) TS_NodeAlias_eq(uint64_t a, uint64_t b) {
53227         LDKNodeAlias a_conv;
53228         a_conv.inner = untag_ptr(a);
53229         a_conv.is_owned = ptr_is_owned(a);
53230         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53231         a_conv.is_owned = false;
53232         LDKNodeAlias b_conv;
53233         b_conv.inner = untag_ptr(b);
53234         b_conv.is_owned = ptr_is_owned(b);
53235         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53236         b_conv.is_owned = false;
53237         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
53238         return ret_conv;
53239 }
53240
53241 int8_tArray  __attribute__((export_name("TS_NodeAlias_write"))) TS_NodeAlias_write(uint64_t obj) {
53242         LDKNodeAlias obj_conv;
53243         obj_conv.inner = untag_ptr(obj);
53244         obj_conv.is_owned = ptr_is_owned(obj);
53245         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53246         obj_conv.is_owned = false;
53247         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
53248         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53249         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53250         CVec_u8Z_free(ret_var);
53251         return ret_arr;
53252 }
53253
53254 uint64_t  __attribute__((export_name("TS_NodeAlias_read"))) TS_NodeAlias_read(int8_tArray ser) {
53255         LDKu8slice ser_ref;
53256         ser_ref.datalen = ser->arr_len;
53257         ser_ref.data = ser->elems;
53258         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
53259         *ret_conv = NodeAlias_read(ser_ref);
53260         FREE(ser);
53261         return tag_ptr(ret_conv, true);
53262 }
53263
53264 void  __attribute__((export_name("TS_NodeInfo_free"))) TS_NodeInfo_free(uint64_t this_obj) {
53265         LDKNodeInfo this_obj_conv;
53266         this_obj_conv.inner = untag_ptr(this_obj);
53267         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53269         NodeInfo_free(this_obj_conv);
53270 }
53271
53272 int64_tArray  __attribute__((export_name("TS_NodeInfo_get_channels"))) TS_NodeInfo_get_channels(uint64_t this_ptr) {
53273         LDKNodeInfo this_ptr_conv;
53274         this_ptr_conv.inner = untag_ptr(this_ptr);
53275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53277         this_ptr_conv.is_owned = false;
53278         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
53279         int64_tArray ret_arr = NULL;
53280         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53281         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53282         for (size_t i = 0; i < ret_var.datalen; i++) {
53283                 int64_t ret_conv_8_conv = ret_var.data[i];
53284                 ret_arr_ptr[i] = ret_conv_8_conv;
53285         }
53286         
53287         FREE(ret_var.data);
53288         return ret_arr;
53289 }
53290
53291 void  __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_channels(uint64_t this_ptr, int64_tArray val) {
53292         LDKNodeInfo this_ptr_conv;
53293         this_ptr_conv.inner = untag_ptr(this_ptr);
53294         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53296         this_ptr_conv.is_owned = false;
53297         LDKCVec_u64Z val_constr;
53298         val_constr.datalen = val->arr_len;
53299         if (val_constr.datalen > 0)
53300                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53301         else
53302                 val_constr.data = NULL;
53303         int64_t* val_vals = val->elems;
53304         for (size_t i = 0; i < val_constr.datalen; i++) {
53305                 int64_t val_conv_8 = val_vals[i];
53306                 val_constr.data[i] = val_conv_8;
53307         }
53308         FREE(val);
53309         NodeInfo_set_channels(&this_ptr_conv, val_constr);
53310 }
53311
53312 uint64_t  __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) {
53313         LDKNodeInfo this_ptr_conv;
53314         this_ptr_conv.inner = untag_ptr(this_ptr);
53315         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53316         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53317         this_ptr_conv.is_owned = false;
53318         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
53319         uint64_t ret_ref = 0;
53320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53322         return ret_ref;
53323 }
53324
53325 void  __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeInfo_set_announcement_info(uint64_t this_ptr, uint64_t val) {
53326         LDKNodeInfo this_ptr_conv;
53327         this_ptr_conv.inner = untag_ptr(this_ptr);
53328         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53330         this_ptr_conv.is_owned = false;
53331         LDKNodeAnnouncementInfo val_conv;
53332         val_conv.inner = untag_ptr(val);
53333         val_conv.is_owned = ptr_is_owned(val);
53334         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53335         val_conv = NodeAnnouncementInfo_clone(&val_conv);
53336         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
53337 }
53338
53339 uint64_t  __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) {
53340         LDKCVec_u64Z channels_arg_constr;
53341         channels_arg_constr.datalen = channels_arg->arr_len;
53342         if (channels_arg_constr.datalen > 0)
53343                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
53344         else
53345                 channels_arg_constr.data = NULL;
53346         int64_t* channels_arg_vals = channels_arg->elems;
53347         for (size_t i = 0; i < channels_arg_constr.datalen; i++) {
53348                 int64_t channels_arg_conv_8 = channels_arg_vals[i];
53349                 channels_arg_constr.data[i] = channels_arg_conv_8;
53350         }
53351         FREE(channels_arg);
53352         LDKNodeAnnouncementInfo announcement_info_arg_conv;
53353         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
53354         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
53355         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
53356         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
53357         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
53358         uint64_t ret_ref = 0;
53359         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53360         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53361         return ret_ref;
53362 }
53363
53364 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
53365         LDKNodeInfo ret_var = NodeInfo_clone(arg);
53366         uint64_t ret_ref = 0;
53367         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53368         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53369         return ret_ref;
53370 }
53371 int64_t  __attribute__((export_name("TS_NodeInfo_clone_ptr"))) TS_NodeInfo_clone_ptr(uint64_t arg) {
53372         LDKNodeInfo arg_conv;
53373         arg_conv.inner = untag_ptr(arg);
53374         arg_conv.is_owned = ptr_is_owned(arg);
53375         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53376         arg_conv.is_owned = false;
53377         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
53378         return ret_conv;
53379 }
53380
53381 uint64_t  __attribute__((export_name("TS_NodeInfo_clone"))) TS_NodeInfo_clone(uint64_t orig) {
53382         LDKNodeInfo orig_conv;
53383         orig_conv.inner = untag_ptr(orig);
53384         orig_conv.is_owned = ptr_is_owned(orig);
53385         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53386         orig_conv.is_owned = false;
53387         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
53388         uint64_t ret_ref = 0;
53389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53391         return ret_ref;
53392 }
53393
53394 jboolean  __attribute__((export_name("TS_NodeInfo_eq"))) TS_NodeInfo_eq(uint64_t a, uint64_t b) {
53395         LDKNodeInfo a_conv;
53396         a_conv.inner = untag_ptr(a);
53397         a_conv.is_owned = ptr_is_owned(a);
53398         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53399         a_conv.is_owned = false;
53400         LDKNodeInfo b_conv;
53401         b_conv.inner = untag_ptr(b);
53402         b_conv.is_owned = ptr_is_owned(b);
53403         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53404         b_conv.is_owned = false;
53405         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
53406         return ret_conv;
53407 }
53408
53409 int8_tArray  __attribute__((export_name("TS_NodeInfo_write"))) TS_NodeInfo_write(uint64_t obj) {
53410         LDKNodeInfo obj_conv;
53411         obj_conv.inner = untag_ptr(obj);
53412         obj_conv.is_owned = ptr_is_owned(obj);
53413         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53414         obj_conv.is_owned = false;
53415         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
53416         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53417         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53418         CVec_u8Z_free(ret_var);
53419         return ret_arr;
53420 }
53421
53422 uint64_t  __attribute__((export_name("TS_NodeInfo_read"))) TS_NodeInfo_read(int8_tArray ser) {
53423         LDKu8slice ser_ref;
53424         ser_ref.datalen = ser->arr_len;
53425         ser_ref.data = ser->elems;
53426         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
53427         *ret_conv = NodeInfo_read(ser_ref);
53428         FREE(ser);
53429         return tag_ptr(ret_conv, true);
53430 }
53431
53432 int8_tArray  __attribute__((export_name("TS_NetworkGraph_write"))) TS_NetworkGraph_write(uint64_t obj) {
53433         LDKNetworkGraph obj_conv;
53434         obj_conv.inner = untag_ptr(obj);
53435         obj_conv.is_owned = ptr_is_owned(obj);
53436         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53437         obj_conv.is_owned = false;
53438         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
53439         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53440         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53441         CVec_u8Z_free(ret_var);
53442         return ret_arr;
53443 }
53444
53445 uint64_t  __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_read(int8_tArray ser, uint64_t arg) {
53446         LDKu8slice ser_ref;
53447         ser_ref.datalen = ser->arr_len;
53448         ser_ref.data = ser->elems;
53449         void* arg_ptr = untag_ptr(arg);
53450         CHECK_ACCESS(arg_ptr);
53451         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
53452         if (arg_conv.free == LDKLogger_JCalls_free) {
53453                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53454                 LDKLogger_JCalls_cloned(&arg_conv);
53455         }
53456         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
53457         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
53458         FREE(ser);
53459         return tag_ptr(ret_conv, true);
53460 }
53461
53462 uint64_t  __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) {
53463         LDKNetwork network_conv = LDKNetwork_from_js(network);
53464         void* logger_ptr = untag_ptr(logger);
53465         CHECK_ACCESS(logger_ptr);
53466         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53467         if (logger_conv.free == LDKLogger_JCalls_free) {
53468                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53469                 LDKLogger_JCalls_cloned(&logger_conv);
53470         }
53471         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
53472         uint64_t ret_ref = 0;
53473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53475         return ret_ref;
53476 }
53477
53478 uint64_t  __attribute__((export_name("TS_NetworkGraph_read_only"))) TS_NetworkGraph_read_only(uint64_t this_arg) {
53479         LDKNetworkGraph this_arg_conv;
53480         this_arg_conv.inner = untag_ptr(this_arg);
53481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53483         this_arg_conv.is_owned = false;
53484         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
53485         uint64_t ret_ref = 0;
53486         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53487         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53488         return ret_ref;
53489 }
53490
53491 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) {
53492         LDKNetworkGraph this_arg_conv;
53493         this_arg_conv.inner = untag_ptr(this_arg);
53494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53496         this_arg_conv.is_owned = false;
53497         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
53498         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
53499         uint64_t ret_ref = tag_ptr(ret_copy, true);
53500         return ret_ref;
53501 }
53502
53503 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) {
53504         LDKNetworkGraph this_arg_conv;
53505         this_arg_conv.inner = untag_ptr(this_arg);
53506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53508         this_arg_conv.is_owned = false;
53509         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
53510 }
53511
53512 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_node_from_announcement"))) TS_NetworkGraph_update_node_from_announcement(uint64_t this_arg, uint64_t msg) {
53513         LDKNetworkGraph this_arg_conv;
53514         this_arg_conv.inner = untag_ptr(this_arg);
53515         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53517         this_arg_conv.is_owned = false;
53518         LDKNodeAnnouncement msg_conv;
53519         msg_conv.inner = untag_ptr(msg);
53520         msg_conv.is_owned = ptr_is_owned(msg);
53521         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53522         msg_conv.is_owned = false;
53523         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53524         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
53525         return tag_ptr(ret_conv, true);
53526 }
53527
53528 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) {
53529         LDKNetworkGraph this_arg_conv;
53530         this_arg_conv.inner = untag_ptr(this_arg);
53531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53533         this_arg_conv.is_owned = false;
53534         LDKUnsignedNodeAnnouncement msg_conv;
53535         msg_conv.inner = untag_ptr(msg);
53536         msg_conv.is_owned = ptr_is_owned(msg);
53537         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53538         msg_conv.is_owned = false;
53539         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53540         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
53541         return tag_ptr(ret_conv, true);
53542 }
53543
53544 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) {
53545         LDKNetworkGraph this_arg_conv;
53546         this_arg_conv.inner = untag_ptr(this_arg);
53547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53549         this_arg_conv.is_owned = false;
53550         LDKChannelAnnouncement msg_conv;
53551         msg_conv.inner = untag_ptr(msg);
53552         msg_conv.is_owned = ptr_is_owned(msg);
53553         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53554         msg_conv.is_owned = false;
53555         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
53556         CHECK_ACCESS(utxo_lookup_ptr);
53557         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
53558         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
53559         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
53560                 // Manually implement clone for Java trait instances
53561                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
53562                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53563                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
53564                 }
53565         }
53566         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53567         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
53568         return tag_ptr(ret_conv, true);
53569 }
53570
53571 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) {
53572         LDKNetworkGraph this_arg_conv;
53573         this_arg_conv.inner = untag_ptr(this_arg);
53574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53576         this_arg_conv.is_owned = false;
53577         LDKChannelAnnouncement msg_conv;
53578         msg_conv.inner = untag_ptr(msg);
53579         msg_conv.is_owned = ptr_is_owned(msg);
53580         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53581         msg_conv.is_owned = false;
53582         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53583         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
53584         return tag_ptr(ret_conv, true);
53585 }
53586
53587 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) {
53588         LDKNetworkGraph this_arg_conv;
53589         this_arg_conv.inner = untag_ptr(this_arg);
53590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53592         this_arg_conv.is_owned = false;
53593         LDKUnsignedChannelAnnouncement msg_conv;
53594         msg_conv.inner = untag_ptr(msg);
53595         msg_conv.is_owned = ptr_is_owned(msg);
53596         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53597         msg_conv.is_owned = false;
53598         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
53599         CHECK_ACCESS(utxo_lookup_ptr);
53600         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
53601         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
53602         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
53603                 // Manually implement clone for Java trait instances
53604                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
53605                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53606                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
53607                 }
53608         }
53609         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53610         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
53611         return tag_ptr(ret_conv, true);
53612 }
53613
53614 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) {
53615         LDKNetworkGraph this_arg_conv;
53616         this_arg_conv.inner = untag_ptr(this_arg);
53617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53619         this_arg_conv.is_owned = false;
53620         LDKChannelFeatures features_conv;
53621         features_conv.inner = untag_ptr(features);
53622         features_conv.is_owned = ptr_is_owned(features);
53623         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
53624         features_conv = ChannelFeatures_clone(&features_conv);
53625         LDKPublicKey node_id_1_ref;
53626         CHECK(node_id_1->arr_len == 33);
53627         memcpy(node_id_1_ref.compressed_form, node_id_1->elems, 33); FREE(node_id_1);
53628         LDKPublicKey node_id_2_ref;
53629         CHECK(node_id_2->arr_len == 33);
53630         memcpy(node_id_2_ref.compressed_form, node_id_2->elems, 33); FREE(node_id_2);
53631         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53632         *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);
53633         return tag_ptr(ret_conv, true);
53634 }
53635
53636 void  __attribute__((export_name("TS_NetworkGraph_channel_failed_permanent"))) TS_NetworkGraph_channel_failed_permanent(uint64_t this_arg, int64_t short_channel_id) {
53637         LDKNetworkGraph this_arg_conv;
53638         this_arg_conv.inner = untag_ptr(this_arg);
53639         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53641         this_arg_conv.is_owned = false;
53642         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
53643 }
53644
53645 void  __attribute__((export_name("TS_NetworkGraph_node_failed_permanent"))) TS_NetworkGraph_node_failed_permanent(uint64_t this_arg, int8_tArray node_id) {
53646         LDKNetworkGraph this_arg_conv;
53647         this_arg_conv.inner = untag_ptr(this_arg);
53648         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53650         this_arg_conv.is_owned = false;
53651         LDKPublicKey node_id_ref;
53652         CHECK(node_id->arr_len == 33);
53653         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
53654         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
53655 }
53656
53657 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) {
53658         LDKNetworkGraph 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         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
53664 }
53665
53666 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel"))) TS_NetworkGraph_update_channel(uint64_t this_arg, uint64_t msg) {
53667         LDKNetworkGraph this_arg_conv;
53668         this_arg_conv.inner = untag_ptr(this_arg);
53669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53671         this_arg_conv.is_owned = false;
53672         LDKChannelUpdate msg_conv;
53673         msg_conv.inner = untag_ptr(msg);
53674         msg_conv.is_owned = ptr_is_owned(msg);
53675         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53676         msg_conv.is_owned = false;
53677         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53678         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
53679         return tag_ptr(ret_conv, true);
53680 }
53681
53682 uint64_t  __attribute__((export_name("TS_NetworkGraph_update_channel_unsigned"))) TS_NetworkGraph_update_channel_unsigned(uint64_t this_arg, uint64_t msg) {
53683         LDKNetworkGraph this_arg_conv;
53684         this_arg_conv.inner = untag_ptr(this_arg);
53685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53687         this_arg_conv.is_owned = false;
53688         LDKUnsignedChannelUpdate msg_conv;
53689         msg_conv.inner = untag_ptr(msg);
53690         msg_conv.is_owned = ptr_is_owned(msg);
53691         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
53692         msg_conv.is_owned = false;
53693         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
53694         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
53695         return tag_ptr(ret_conv, true);
53696 }
53697
53698 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_channel"))) TS_ReadOnlyNetworkGraph_channel(uint64_t this_arg, int64_t short_channel_id) {
53699         LDKReadOnlyNetworkGraph this_arg_conv;
53700         this_arg_conv.inner = untag_ptr(this_arg);
53701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53703         this_arg_conv.is_owned = false;
53704         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
53705         uint64_t ret_ref = 0;
53706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53708         return ret_ref;
53709 }
53710
53711 int64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_channels"))) TS_ReadOnlyNetworkGraph_list_channels(uint64_t this_arg) {
53712         LDKReadOnlyNetworkGraph this_arg_conv;
53713         this_arg_conv.inner = untag_ptr(this_arg);
53714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53716         this_arg_conv.is_owned = false;
53717         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
53718         int64_tArray ret_arr = NULL;
53719         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
53720         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
53721         for (size_t i = 0; i < ret_var.datalen; i++) {
53722                 int64_t ret_conv_8_conv = ret_var.data[i];
53723                 ret_arr_ptr[i] = ret_conv_8_conv;
53724         }
53725         
53726         FREE(ret_var.data);
53727         return ret_arr;
53728 }
53729
53730 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_node"))) TS_ReadOnlyNetworkGraph_node(uint64_t this_arg, uint64_t node_id) {
53731         LDKReadOnlyNetworkGraph this_arg_conv;
53732         this_arg_conv.inner = untag_ptr(this_arg);
53733         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53735         this_arg_conv.is_owned = false;
53736         LDKNodeId node_id_conv;
53737         node_id_conv.inner = untag_ptr(node_id);
53738         node_id_conv.is_owned = ptr_is_owned(node_id);
53739         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
53740         node_id_conv.is_owned = false;
53741         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
53742         uint64_t ret_ref = 0;
53743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53745         return ret_ref;
53746 }
53747
53748 uint64_tArray  __attribute__((export_name("TS_ReadOnlyNetworkGraph_list_nodes"))) TS_ReadOnlyNetworkGraph_list_nodes(uint64_t this_arg) {
53749         LDKReadOnlyNetworkGraph this_arg_conv;
53750         this_arg_conv.inner = untag_ptr(this_arg);
53751         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53753         this_arg_conv.is_owned = false;
53754         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
53755         uint64_tArray ret_arr = NULL;
53756         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
53757         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
53758         for (size_t i = 0; i < ret_var.datalen; i++) {
53759                 LDKNodeId ret_conv_8_var = ret_var.data[i];
53760                 uint64_t ret_conv_8_ref = 0;
53761                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
53762                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
53763                 ret_arr_ptr[i] = ret_conv_8_ref;
53764         }
53765         
53766         FREE(ret_var.data);
53767         return ret_arr;
53768 }
53769
53770 uint64_t  __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) TS_ReadOnlyNetworkGraph_get_addresses(uint64_t this_arg, int8_tArray pubkey) {
53771         LDKReadOnlyNetworkGraph this_arg_conv;
53772         this_arg_conv.inner = untag_ptr(this_arg);
53773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53775         this_arg_conv.is_owned = false;
53776         LDKPublicKey pubkey_ref;
53777         CHECK(pubkey->arr_len == 33);
53778         memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey);
53779         LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
53780         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
53781         uint64_t ret_ref = tag_ptr(ret_copy, true);
53782         return ret_ref;
53783 }
53784
53785 void  __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) {
53786         LDKDefaultRouter this_obj_conv;
53787         this_obj_conv.inner = untag_ptr(this_obj);
53788         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53790         DefaultRouter_free(this_obj_conv);
53791 }
53792
53793 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) {
53794         LDKNetworkGraph network_graph_conv;
53795         network_graph_conv.inner = untag_ptr(network_graph);
53796         network_graph_conv.is_owned = ptr_is_owned(network_graph);
53797         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
53798         network_graph_conv.is_owned = false;
53799         void* logger_ptr = untag_ptr(logger);
53800         CHECK_ACCESS(logger_ptr);
53801         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
53802         if (logger_conv.free == LDKLogger_JCalls_free) {
53803                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53804                 LDKLogger_JCalls_cloned(&logger_conv);
53805         }
53806         LDKThirtyTwoBytes random_seed_bytes_ref;
53807         CHECK(random_seed_bytes->arr_len == 32);
53808         memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
53809         void* scorer_ptr = untag_ptr(scorer);
53810         CHECK_ACCESS(scorer_ptr);
53811         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
53812         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
53813                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53814                 LDKLockableScore_JCalls_cloned(&scorer_conv);
53815         }
53816         LDKProbabilisticScoringFeeParameters score_params_conv;
53817         score_params_conv.inner = untag_ptr(score_params);
53818         score_params_conv.is_owned = ptr_is_owned(score_params);
53819         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
53820         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
53821         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv, score_params_conv);
53822         uint64_t ret_ref = 0;
53823         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53824         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53825         return ret_ref;
53826 }
53827
53828 uint64_t  __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) {
53829         LDKDefaultRouter this_arg_conv;
53830         this_arg_conv.inner = untag_ptr(this_arg);
53831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53833         this_arg_conv.is_owned = false;
53834         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
53835         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
53836         return tag_ptr(ret_ret, true);
53837 }
53838
53839 void  __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) {
53840         if (!ptr_is_owned(this_ptr)) return;
53841         void* this_ptr_ptr = untag_ptr(this_ptr);
53842         CHECK_ACCESS(this_ptr_ptr);
53843         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
53844         FREE(untag_ptr(this_ptr));
53845         Router_free(this_ptr_conv);
53846 }
53847
53848 void  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) {
53849         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
53850         this_obj_conv.inner = untag_ptr(this_obj);
53851         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53853         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
53854 }
53855
53856 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) {
53857         void* scorer_ptr = untag_ptr(scorer);
53858         CHECK_ACCESS(scorer_ptr);
53859         LDKScore scorer_conv = *(LDKScore*)(scorer_ptr);
53860         if (scorer_conv.free == LDKScore_JCalls_free) {
53861                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
53862                 LDKScore_JCalls_cloned(&scorer_conv);
53863         }
53864         LDKInFlightHtlcs inflight_htlcs_conv;
53865         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
53866         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
53867         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
53868         inflight_htlcs_conv.is_owned = false;
53869         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
53870         uint64_t ret_ref = 0;
53871         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53872         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53873         return ret_ref;
53874 }
53875
53876 int8_tArray  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) {
53877         LDKScorerAccountingForInFlightHtlcs obj_conv;
53878         obj_conv.inner = untag_ptr(obj);
53879         obj_conv.is_owned = ptr_is_owned(obj);
53880         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
53881         obj_conv.is_owned = false;
53882         LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv);
53883         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
53884         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
53885         CVec_u8Z_free(ret_var);
53886         return ret_arr;
53887 }
53888
53889 uint64_t  __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) {
53890         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
53891         this_arg_conv.inner = untag_ptr(this_arg);
53892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53894         this_arg_conv.is_owned = false;
53895         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
53896         *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv);
53897         return tag_ptr(ret_ret, true);
53898 }
53899
53900 void  __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) {
53901         LDKInFlightHtlcs this_obj_conv;
53902         this_obj_conv.inner = untag_ptr(this_obj);
53903         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53905         InFlightHtlcs_free(this_obj_conv);
53906 }
53907
53908 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
53909         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
53910         uint64_t ret_ref = 0;
53911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53913         return ret_ref;
53914 }
53915 int64_t  __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) {
53916         LDKInFlightHtlcs arg_conv;
53917         arg_conv.inner = untag_ptr(arg);
53918         arg_conv.is_owned = ptr_is_owned(arg);
53919         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53920         arg_conv.is_owned = false;
53921         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
53922         return ret_conv;
53923 }
53924
53925 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) {
53926         LDKInFlightHtlcs orig_conv;
53927         orig_conv.inner = untag_ptr(orig);
53928         orig_conv.is_owned = ptr_is_owned(orig);
53929         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53930         orig_conv.is_owned = false;
53931         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
53932         uint64_t ret_ref = 0;
53933         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53934         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53935         return ret_ref;
53936 }
53937
53938 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() {
53939         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
53940         uint64_t ret_ref = 0;
53941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53943         return ret_ref;
53944 }
53945
53946 void  __attribute__((export_name("TS_InFlightHtlcs_process_path"))) TS_InFlightHtlcs_process_path(uint64_t this_arg, uint64_t path, int8_tArray payer_node_id) {
53947         LDKInFlightHtlcs this_arg_conv;
53948         this_arg_conv.inner = untag_ptr(this_arg);
53949         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53951         this_arg_conv.is_owned = false;
53952         LDKPath path_conv;
53953         path_conv.inner = untag_ptr(path);
53954         path_conv.is_owned = ptr_is_owned(path);
53955         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
53956         path_conv.is_owned = false;
53957         LDKPublicKey payer_node_id_ref;
53958         CHECK(payer_node_id->arr_len == 33);
53959         memcpy(payer_node_id_ref.compressed_form, payer_node_id->elems, 33); FREE(payer_node_id);
53960         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
53961 }
53962
53963 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) {
53964         LDKInFlightHtlcs this_arg_conv;
53965         this_arg_conv.inner = untag_ptr(this_arg);
53966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53968         this_arg_conv.is_owned = false;
53969         LDKNodeId source_conv;
53970         source_conv.inner = untag_ptr(source);
53971         source_conv.is_owned = ptr_is_owned(source);
53972         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
53973         source_conv.is_owned = false;
53974         LDKNodeId target_conv;
53975         target_conv.inner = untag_ptr(target);
53976         target_conv.is_owned = ptr_is_owned(target);
53977         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
53978         target_conv.is_owned = false;
53979         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
53980 }
53981
53982 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) {
53983         LDKInFlightHtlcs this_arg_conv;
53984         this_arg_conv.inner = untag_ptr(this_arg);
53985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
53986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
53987         this_arg_conv.is_owned = false;
53988         LDKNodeId source_conv;
53989         source_conv.inner = untag_ptr(source);
53990         source_conv.is_owned = ptr_is_owned(source);
53991         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
53992         source_conv.is_owned = false;
53993         LDKNodeId target_conv;
53994         target_conv.inner = untag_ptr(target);
53995         target_conv.is_owned = ptr_is_owned(target);
53996         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
53997         target_conv.is_owned = false;
53998         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53999         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
54000         uint64_t ret_ref = tag_ptr(ret_copy, true);
54001         return ret_ref;
54002 }
54003
54004 int8_tArray  __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) {
54005         LDKInFlightHtlcs obj_conv;
54006         obj_conv.inner = untag_ptr(obj);
54007         obj_conv.is_owned = ptr_is_owned(obj);
54008         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54009         obj_conv.is_owned = false;
54010         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
54011         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54012         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54013         CVec_u8Z_free(ret_var);
54014         return ret_arr;
54015 }
54016
54017 uint64_t  __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) {
54018         LDKu8slice ser_ref;
54019         ser_ref.datalen = ser->arr_len;
54020         ser_ref.data = ser->elems;
54021         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
54022         *ret_conv = InFlightHtlcs_read(ser_ref);
54023         FREE(ser);
54024         return tag_ptr(ret_conv, true);
54025 }
54026
54027 void  __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) {
54028         LDKRouteHop this_obj_conv;
54029         this_obj_conv.inner = untag_ptr(this_obj);
54030         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54031         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54032         RouteHop_free(this_obj_conv);
54033 }
54034
54035 int8_tArray  __attribute__((export_name("TS_RouteHop_get_pubkey"))) TS_RouteHop_get_pubkey(uint64_t this_ptr) {
54036         LDKRouteHop this_ptr_conv;
54037         this_ptr_conv.inner = untag_ptr(this_ptr);
54038         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54040         this_ptr_conv.is_owned = false;
54041         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54042         memcpy(ret_arr->elems, RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
54043         return ret_arr;
54044 }
54045
54046 void  __attribute__((export_name("TS_RouteHop_set_pubkey"))) TS_RouteHop_set_pubkey(uint64_t this_ptr, int8_tArray val) {
54047         LDKRouteHop this_ptr_conv;
54048         this_ptr_conv.inner = untag_ptr(this_ptr);
54049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54051         this_ptr_conv.is_owned = false;
54052         LDKPublicKey val_ref;
54053         CHECK(val->arr_len == 33);
54054         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
54055         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
54056 }
54057
54058 uint64_t  __attribute__((export_name("TS_RouteHop_get_node_features"))) TS_RouteHop_get_node_features(uint64_t this_ptr) {
54059         LDKRouteHop this_ptr_conv;
54060         this_ptr_conv.inner = untag_ptr(this_ptr);
54061         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54063         this_ptr_conv.is_owned = false;
54064         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
54065         uint64_t ret_ref = 0;
54066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54068         return ret_ref;
54069 }
54070
54071 void  __attribute__((export_name("TS_RouteHop_set_node_features"))) TS_RouteHop_set_node_features(uint64_t this_ptr, uint64_t val) {
54072         LDKRouteHop this_ptr_conv;
54073         this_ptr_conv.inner = untag_ptr(this_ptr);
54074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54076         this_ptr_conv.is_owned = false;
54077         LDKNodeFeatures val_conv;
54078         val_conv.inner = untag_ptr(val);
54079         val_conv.is_owned = ptr_is_owned(val);
54080         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54081         val_conv = NodeFeatures_clone(&val_conv);
54082         RouteHop_set_node_features(&this_ptr_conv, val_conv);
54083 }
54084
54085 int64_t  __attribute__((export_name("TS_RouteHop_get_short_channel_id"))) TS_RouteHop_get_short_channel_id(uint64_t this_ptr) {
54086         LDKRouteHop this_ptr_conv;
54087         this_ptr_conv.inner = untag_ptr(this_ptr);
54088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54090         this_ptr_conv.is_owned = false;
54091         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
54092         return ret_conv;
54093 }
54094
54095 void  __attribute__((export_name("TS_RouteHop_set_short_channel_id"))) TS_RouteHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
54096         LDKRouteHop this_ptr_conv;
54097         this_ptr_conv.inner = untag_ptr(this_ptr);
54098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54100         this_ptr_conv.is_owned = false;
54101         RouteHop_set_short_channel_id(&this_ptr_conv, val);
54102 }
54103
54104 uint64_t  __attribute__((export_name("TS_RouteHop_get_channel_features"))) TS_RouteHop_get_channel_features(uint64_t this_ptr) {
54105         LDKRouteHop this_ptr_conv;
54106         this_ptr_conv.inner = untag_ptr(this_ptr);
54107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54109         this_ptr_conv.is_owned = false;
54110         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
54111         uint64_t ret_ref = 0;
54112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54114         return ret_ref;
54115 }
54116
54117 void  __attribute__((export_name("TS_RouteHop_set_channel_features"))) TS_RouteHop_set_channel_features(uint64_t this_ptr, uint64_t val) {
54118         LDKRouteHop this_ptr_conv;
54119         this_ptr_conv.inner = untag_ptr(this_ptr);
54120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54122         this_ptr_conv.is_owned = false;
54123         LDKChannelFeatures val_conv;
54124         val_conv.inner = untag_ptr(val);
54125         val_conv.is_owned = ptr_is_owned(val);
54126         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54127         val_conv = ChannelFeatures_clone(&val_conv);
54128         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
54129 }
54130
54131 int64_t  __attribute__((export_name("TS_RouteHop_get_fee_msat"))) TS_RouteHop_get_fee_msat(uint64_t this_ptr) {
54132         LDKRouteHop this_ptr_conv;
54133         this_ptr_conv.inner = untag_ptr(this_ptr);
54134         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54135         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54136         this_ptr_conv.is_owned = false;
54137         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
54138         return ret_conv;
54139 }
54140
54141 void  __attribute__((export_name("TS_RouteHop_set_fee_msat"))) TS_RouteHop_set_fee_msat(uint64_t this_ptr, int64_t val) {
54142         LDKRouteHop this_ptr_conv;
54143         this_ptr_conv.inner = untag_ptr(this_ptr);
54144         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54146         this_ptr_conv.is_owned = false;
54147         RouteHop_set_fee_msat(&this_ptr_conv, val);
54148 }
54149
54150 int32_t  __attribute__((export_name("TS_RouteHop_get_cltv_expiry_delta"))) TS_RouteHop_get_cltv_expiry_delta(uint64_t this_ptr) {
54151         LDKRouteHop this_ptr_conv;
54152         this_ptr_conv.inner = untag_ptr(this_ptr);
54153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54155         this_ptr_conv.is_owned = false;
54156         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
54157         return ret_conv;
54158 }
54159
54160 void  __attribute__((export_name("TS_RouteHop_set_cltv_expiry_delta"))) TS_RouteHop_set_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
54161         LDKRouteHop this_ptr_conv;
54162         this_ptr_conv.inner = untag_ptr(this_ptr);
54163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54165         this_ptr_conv.is_owned = false;
54166         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
54167 }
54168
54169 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) {
54170         LDKPublicKey pubkey_arg_ref;
54171         CHECK(pubkey_arg->arr_len == 33);
54172         memcpy(pubkey_arg_ref.compressed_form, pubkey_arg->elems, 33); FREE(pubkey_arg);
54173         LDKNodeFeatures node_features_arg_conv;
54174         node_features_arg_conv.inner = untag_ptr(node_features_arg);
54175         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
54176         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
54177         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
54178         LDKChannelFeatures channel_features_arg_conv;
54179         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
54180         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
54181         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
54182         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
54183         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);
54184         uint64_t ret_ref = 0;
54185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54187         return ret_ref;
54188 }
54189
54190 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
54191         LDKRouteHop ret_var = RouteHop_clone(arg);
54192         uint64_t ret_ref = 0;
54193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54195         return ret_ref;
54196 }
54197 int64_t  __attribute__((export_name("TS_RouteHop_clone_ptr"))) TS_RouteHop_clone_ptr(uint64_t arg) {
54198         LDKRouteHop arg_conv;
54199         arg_conv.inner = untag_ptr(arg);
54200         arg_conv.is_owned = ptr_is_owned(arg);
54201         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54202         arg_conv.is_owned = false;
54203         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
54204         return ret_conv;
54205 }
54206
54207 uint64_t  __attribute__((export_name("TS_RouteHop_clone"))) TS_RouteHop_clone(uint64_t orig) {
54208         LDKRouteHop orig_conv;
54209         orig_conv.inner = untag_ptr(orig);
54210         orig_conv.is_owned = ptr_is_owned(orig);
54211         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54212         orig_conv.is_owned = false;
54213         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
54214         uint64_t ret_ref = 0;
54215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54217         return ret_ref;
54218 }
54219
54220 int64_t  __attribute__((export_name("TS_RouteHop_hash"))) TS_RouteHop_hash(uint64_t o) {
54221         LDKRouteHop o_conv;
54222         o_conv.inner = untag_ptr(o);
54223         o_conv.is_owned = ptr_is_owned(o);
54224         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54225         o_conv.is_owned = false;
54226         int64_t ret_conv = RouteHop_hash(&o_conv);
54227         return ret_conv;
54228 }
54229
54230 jboolean  __attribute__((export_name("TS_RouteHop_eq"))) TS_RouteHop_eq(uint64_t a, uint64_t b) {
54231         LDKRouteHop a_conv;
54232         a_conv.inner = untag_ptr(a);
54233         a_conv.is_owned = ptr_is_owned(a);
54234         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54235         a_conv.is_owned = false;
54236         LDKRouteHop b_conv;
54237         b_conv.inner = untag_ptr(b);
54238         b_conv.is_owned = ptr_is_owned(b);
54239         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54240         b_conv.is_owned = false;
54241         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
54242         return ret_conv;
54243 }
54244
54245 int8_tArray  __attribute__((export_name("TS_RouteHop_write"))) TS_RouteHop_write(uint64_t obj) {
54246         LDKRouteHop obj_conv;
54247         obj_conv.inner = untag_ptr(obj);
54248         obj_conv.is_owned = ptr_is_owned(obj);
54249         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54250         obj_conv.is_owned = false;
54251         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
54252         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54253         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54254         CVec_u8Z_free(ret_var);
54255         return ret_arr;
54256 }
54257
54258 uint64_t  __attribute__((export_name("TS_RouteHop_read"))) TS_RouteHop_read(int8_tArray ser) {
54259         LDKu8slice ser_ref;
54260         ser_ref.datalen = ser->arr_len;
54261         ser_ref.data = ser->elems;
54262         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
54263         *ret_conv = RouteHop_read(ser_ref);
54264         FREE(ser);
54265         return tag_ptr(ret_conv, true);
54266 }
54267
54268 void  __attribute__((export_name("TS_BlindedTail_free"))) TS_BlindedTail_free(uint64_t this_obj) {
54269         LDKBlindedTail this_obj_conv;
54270         this_obj_conv.inner = untag_ptr(this_obj);
54271         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54272         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54273         BlindedTail_free(this_obj_conv);
54274 }
54275
54276 uint64_tArray  __attribute__((export_name("TS_BlindedTail_get_hops"))) TS_BlindedTail_get_hops(uint64_t this_ptr) {
54277         LDKBlindedTail this_ptr_conv;
54278         this_ptr_conv.inner = untag_ptr(this_ptr);
54279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54281         this_ptr_conv.is_owned = false;
54282         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
54283         uint64_tArray ret_arr = NULL;
54284         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54285         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54286         for (size_t m = 0; m < ret_var.datalen; m++) {
54287                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
54288                 uint64_t ret_conv_12_ref = 0;
54289                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
54290                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
54291                 ret_arr_ptr[m] = ret_conv_12_ref;
54292         }
54293         
54294         FREE(ret_var.data);
54295         return ret_arr;
54296 }
54297
54298 void  __attribute__((export_name("TS_BlindedTail_set_hops"))) TS_BlindedTail_set_hops(uint64_t this_ptr, uint64_tArray val) {
54299         LDKBlindedTail this_ptr_conv;
54300         this_ptr_conv.inner = untag_ptr(this_ptr);
54301         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54302         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54303         this_ptr_conv.is_owned = false;
54304         LDKCVec_BlindedHopZ val_constr;
54305         val_constr.datalen = val->arr_len;
54306         if (val_constr.datalen > 0)
54307                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
54308         else
54309                 val_constr.data = NULL;
54310         uint64_t* val_vals = val->elems;
54311         for (size_t m = 0; m < val_constr.datalen; m++) {
54312                 uint64_t val_conv_12 = val_vals[m];
54313                 LDKBlindedHop val_conv_12_conv;
54314                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
54315                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
54316                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
54317                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
54318                 val_constr.data[m] = val_conv_12_conv;
54319         }
54320         FREE(val);
54321         BlindedTail_set_hops(&this_ptr_conv, val_constr);
54322 }
54323
54324 int8_tArray  __attribute__((export_name("TS_BlindedTail_get_blinding_point"))) TS_BlindedTail_get_blinding_point(uint64_t this_ptr) {
54325         LDKBlindedTail this_ptr_conv;
54326         this_ptr_conv.inner = untag_ptr(this_ptr);
54327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54329         this_ptr_conv.is_owned = false;
54330         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
54331         memcpy(ret_arr->elems, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form, 33);
54332         return ret_arr;
54333 }
54334
54335 void  __attribute__((export_name("TS_BlindedTail_set_blinding_point"))) TS_BlindedTail_set_blinding_point(uint64_t this_ptr, int8_tArray val) {
54336         LDKBlindedTail this_ptr_conv;
54337         this_ptr_conv.inner = untag_ptr(this_ptr);
54338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54340         this_ptr_conv.is_owned = false;
54341         LDKPublicKey val_ref;
54342         CHECK(val->arr_len == 33);
54343         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
54344         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
54345 }
54346
54347 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) {
54348         LDKBlindedTail this_ptr_conv;
54349         this_ptr_conv.inner = untag_ptr(this_ptr);
54350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54352         this_ptr_conv.is_owned = false;
54353         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
54354         return ret_conv;
54355 }
54356
54357 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) {
54358         LDKBlindedTail this_ptr_conv;
54359         this_ptr_conv.inner = untag_ptr(this_ptr);
54360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54362         this_ptr_conv.is_owned = false;
54363         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
54364 }
54365
54366 int64_t  __attribute__((export_name("TS_BlindedTail_get_final_value_msat"))) TS_BlindedTail_get_final_value_msat(uint64_t this_ptr) {
54367         LDKBlindedTail this_ptr_conv;
54368         this_ptr_conv.inner = untag_ptr(this_ptr);
54369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54371         this_ptr_conv.is_owned = false;
54372         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
54373         return ret_conv;
54374 }
54375
54376 void  __attribute__((export_name("TS_BlindedTail_set_final_value_msat"))) TS_BlindedTail_set_final_value_msat(uint64_t this_ptr, int64_t val) {
54377         LDKBlindedTail this_ptr_conv;
54378         this_ptr_conv.inner = untag_ptr(this_ptr);
54379         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54381         this_ptr_conv.is_owned = false;
54382         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
54383 }
54384
54385 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) {
54386         LDKCVec_BlindedHopZ hops_arg_constr;
54387         hops_arg_constr.datalen = hops_arg->arr_len;
54388         if (hops_arg_constr.datalen > 0)
54389                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
54390         else
54391                 hops_arg_constr.data = NULL;
54392         uint64_t* hops_arg_vals = hops_arg->elems;
54393         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
54394                 uint64_t hops_arg_conv_12 = hops_arg_vals[m];
54395                 LDKBlindedHop hops_arg_conv_12_conv;
54396                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
54397                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
54398                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
54399                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
54400                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
54401         }
54402         FREE(hops_arg);
54403         LDKPublicKey blinding_point_arg_ref;
54404         CHECK(blinding_point_arg->arr_len == 33);
54405         memcpy(blinding_point_arg_ref.compressed_form, blinding_point_arg->elems, 33); FREE(blinding_point_arg);
54406         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
54407         uint64_t ret_ref = 0;
54408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54410         return ret_ref;
54411 }
54412
54413 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
54414         LDKBlindedTail ret_var = BlindedTail_clone(arg);
54415         uint64_t ret_ref = 0;
54416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54418         return ret_ref;
54419 }
54420 int64_t  __attribute__((export_name("TS_BlindedTail_clone_ptr"))) TS_BlindedTail_clone_ptr(uint64_t arg) {
54421         LDKBlindedTail arg_conv;
54422         arg_conv.inner = untag_ptr(arg);
54423         arg_conv.is_owned = ptr_is_owned(arg);
54424         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54425         arg_conv.is_owned = false;
54426         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
54427         return ret_conv;
54428 }
54429
54430 uint64_t  __attribute__((export_name("TS_BlindedTail_clone"))) TS_BlindedTail_clone(uint64_t orig) {
54431         LDKBlindedTail orig_conv;
54432         orig_conv.inner = untag_ptr(orig);
54433         orig_conv.is_owned = ptr_is_owned(orig);
54434         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54435         orig_conv.is_owned = false;
54436         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
54437         uint64_t ret_ref = 0;
54438         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54439         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54440         return ret_ref;
54441 }
54442
54443 int64_t  __attribute__((export_name("TS_BlindedTail_hash"))) TS_BlindedTail_hash(uint64_t o) {
54444         LDKBlindedTail o_conv;
54445         o_conv.inner = untag_ptr(o);
54446         o_conv.is_owned = ptr_is_owned(o);
54447         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54448         o_conv.is_owned = false;
54449         int64_t ret_conv = BlindedTail_hash(&o_conv);
54450         return ret_conv;
54451 }
54452
54453 jboolean  __attribute__((export_name("TS_BlindedTail_eq"))) TS_BlindedTail_eq(uint64_t a, uint64_t b) {
54454         LDKBlindedTail a_conv;
54455         a_conv.inner = untag_ptr(a);
54456         a_conv.is_owned = ptr_is_owned(a);
54457         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54458         a_conv.is_owned = false;
54459         LDKBlindedTail b_conv;
54460         b_conv.inner = untag_ptr(b);
54461         b_conv.is_owned = ptr_is_owned(b);
54462         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54463         b_conv.is_owned = false;
54464         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
54465         return ret_conv;
54466 }
54467
54468 int8_tArray  __attribute__((export_name("TS_BlindedTail_write"))) TS_BlindedTail_write(uint64_t obj) {
54469         LDKBlindedTail obj_conv;
54470         obj_conv.inner = untag_ptr(obj);
54471         obj_conv.is_owned = ptr_is_owned(obj);
54472         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54473         obj_conv.is_owned = false;
54474         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
54475         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54476         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54477         CVec_u8Z_free(ret_var);
54478         return ret_arr;
54479 }
54480
54481 uint64_t  __attribute__((export_name("TS_BlindedTail_read"))) TS_BlindedTail_read(int8_tArray ser) {
54482         LDKu8slice ser_ref;
54483         ser_ref.datalen = ser->arr_len;
54484         ser_ref.data = ser->elems;
54485         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
54486         *ret_conv = BlindedTail_read(ser_ref);
54487         FREE(ser);
54488         return tag_ptr(ret_conv, true);
54489 }
54490
54491 void  __attribute__((export_name("TS_Path_free"))) TS_Path_free(uint64_t this_obj) {
54492         LDKPath this_obj_conv;
54493         this_obj_conv.inner = untag_ptr(this_obj);
54494         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54496         Path_free(this_obj_conv);
54497 }
54498
54499 uint64_tArray  __attribute__((export_name("TS_Path_get_hops"))) TS_Path_get_hops(uint64_t this_ptr) {
54500         LDKPath this_ptr_conv;
54501         this_ptr_conv.inner = untag_ptr(this_ptr);
54502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54504         this_ptr_conv.is_owned = false;
54505         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
54506         uint64_tArray ret_arr = NULL;
54507         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54508         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54509         for (size_t k = 0; k < ret_var.datalen; k++) {
54510                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
54511                 uint64_t ret_conv_10_ref = 0;
54512                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
54513                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
54514                 ret_arr_ptr[k] = ret_conv_10_ref;
54515         }
54516         
54517         FREE(ret_var.data);
54518         return ret_arr;
54519 }
54520
54521 void  __attribute__((export_name("TS_Path_set_hops"))) TS_Path_set_hops(uint64_t this_ptr, uint64_tArray val) {
54522         LDKPath this_ptr_conv;
54523         this_ptr_conv.inner = untag_ptr(this_ptr);
54524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54526         this_ptr_conv.is_owned = false;
54527         LDKCVec_RouteHopZ val_constr;
54528         val_constr.datalen = val->arr_len;
54529         if (val_constr.datalen > 0)
54530                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
54531         else
54532                 val_constr.data = NULL;
54533         uint64_t* val_vals = val->elems;
54534         for (size_t k = 0; k < val_constr.datalen; k++) {
54535                 uint64_t val_conv_10 = val_vals[k];
54536                 LDKRouteHop val_conv_10_conv;
54537                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
54538                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
54539                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
54540                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
54541                 val_constr.data[k] = val_conv_10_conv;
54542         }
54543         FREE(val);
54544         Path_set_hops(&this_ptr_conv, val_constr);
54545 }
54546
54547 uint64_t  __attribute__((export_name("TS_Path_get_blinded_tail"))) TS_Path_get_blinded_tail(uint64_t this_ptr) {
54548         LDKPath this_ptr_conv;
54549         this_ptr_conv.inner = untag_ptr(this_ptr);
54550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54552         this_ptr_conv.is_owned = false;
54553         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
54554         uint64_t ret_ref = 0;
54555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54557         return ret_ref;
54558 }
54559
54560 void  __attribute__((export_name("TS_Path_set_blinded_tail"))) TS_Path_set_blinded_tail(uint64_t this_ptr, uint64_t val) {
54561         LDKPath this_ptr_conv;
54562         this_ptr_conv.inner = untag_ptr(this_ptr);
54563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54565         this_ptr_conv.is_owned = false;
54566         LDKBlindedTail val_conv;
54567         val_conv.inner = untag_ptr(val);
54568         val_conv.is_owned = ptr_is_owned(val);
54569         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54570         val_conv = BlindedTail_clone(&val_conv);
54571         Path_set_blinded_tail(&this_ptr_conv, val_conv);
54572 }
54573
54574 uint64_t  __attribute__((export_name("TS_Path_new"))) TS_Path_new(uint64_tArray hops_arg, uint64_t blinded_tail_arg) {
54575         LDKCVec_RouteHopZ hops_arg_constr;
54576         hops_arg_constr.datalen = hops_arg->arr_len;
54577         if (hops_arg_constr.datalen > 0)
54578                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
54579         else
54580                 hops_arg_constr.data = NULL;
54581         uint64_t* hops_arg_vals = hops_arg->elems;
54582         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
54583                 uint64_t hops_arg_conv_10 = hops_arg_vals[k];
54584                 LDKRouteHop hops_arg_conv_10_conv;
54585                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
54586                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
54587                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
54588                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
54589                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
54590         }
54591         FREE(hops_arg);
54592         LDKBlindedTail blinded_tail_arg_conv;
54593         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
54594         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
54595         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
54596         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
54597         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
54598         uint64_t ret_ref = 0;
54599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54601         return ret_ref;
54602 }
54603
54604 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
54605         LDKPath ret_var = Path_clone(arg);
54606         uint64_t ret_ref = 0;
54607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54609         return ret_ref;
54610 }
54611 int64_t  __attribute__((export_name("TS_Path_clone_ptr"))) TS_Path_clone_ptr(uint64_t arg) {
54612         LDKPath arg_conv;
54613         arg_conv.inner = untag_ptr(arg);
54614         arg_conv.is_owned = ptr_is_owned(arg);
54615         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54616         arg_conv.is_owned = false;
54617         int64_t ret_conv = Path_clone_ptr(&arg_conv);
54618         return ret_conv;
54619 }
54620
54621 uint64_t  __attribute__((export_name("TS_Path_clone"))) TS_Path_clone(uint64_t orig) {
54622         LDKPath orig_conv;
54623         orig_conv.inner = untag_ptr(orig);
54624         orig_conv.is_owned = ptr_is_owned(orig);
54625         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54626         orig_conv.is_owned = false;
54627         LDKPath ret_var = Path_clone(&orig_conv);
54628         uint64_t ret_ref = 0;
54629         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54630         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54631         return ret_ref;
54632 }
54633
54634 int64_t  __attribute__((export_name("TS_Path_hash"))) TS_Path_hash(uint64_t o) {
54635         LDKPath o_conv;
54636         o_conv.inner = untag_ptr(o);
54637         o_conv.is_owned = ptr_is_owned(o);
54638         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54639         o_conv.is_owned = false;
54640         int64_t ret_conv = Path_hash(&o_conv);
54641         return ret_conv;
54642 }
54643
54644 jboolean  __attribute__((export_name("TS_Path_eq"))) TS_Path_eq(uint64_t a, uint64_t b) {
54645         LDKPath a_conv;
54646         a_conv.inner = untag_ptr(a);
54647         a_conv.is_owned = ptr_is_owned(a);
54648         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54649         a_conv.is_owned = false;
54650         LDKPath b_conv;
54651         b_conv.inner = untag_ptr(b);
54652         b_conv.is_owned = ptr_is_owned(b);
54653         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54654         b_conv.is_owned = false;
54655         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
54656         return ret_conv;
54657 }
54658
54659 int64_t  __attribute__((export_name("TS_Path_fee_msat"))) TS_Path_fee_msat(uint64_t this_arg) {
54660         LDKPath this_arg_conv;
54661         this_arg_conv.inner = untag_ptr(this_arg);
54662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54664         this_arg_conv.is_owned = false;
54665         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
54666         return ret_conv;
54667 }
54668
54669 int64_t  __attribute__((export_name("TS_Path_final_value_msat"))) TS_Path_final_value_msat(uint64_t this_arg) {
54670         LDKPath this_arg_conv;
54671         this_arg_conv.inner = untag_ptr(this_arg);
54672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54674         this_arg_conv.is_owned = false;
54675         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
54676         return ret_conv;
54677 }
54678
54679 uint64_t  __attribute__((export_name("TS_Path_final_cltv_expiry_delta"))) TS_Path_final_cltv_expiry_delta(uint64_t this_arg) {
54680         LDKPath this_arg_conv;
54681         this_arg_conv.inner = untag_ptr(this_arg);
54682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54684         this_arg_conv.is_owned = false;
54685         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
54686         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
54687         uint64_t ret_ref = tag_ptr(ret_copy, true);
54688         return ret_ref;
54689 }
54690
54691 void  __attribute__((export_name("TS_Route_free"))) TS_Route_free(uint64_t this_obj) {
54692         LDKRoute this_obj_conv;
54693         this_obj_conv.inner = untag_ptr(this_obj);
54694         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54696         Route_free(this_obj_conv);
54697 }
54698
54699 uint64_tArray  __attribute__((export_name("TS_Route_get_paths"))) TS_Route_get_paths(uint64_t this_ptr) {
54700         LDKRoute this_ptr_conv;
54701         this_ptr_conv.inner = untag_ptr(this_ptr);
54702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54704         this_ptr_conv.is_owned = false;
54705         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
54706         uint64_tArray ret_arr = NULL;
54707         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
54708         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
54709         for (size_t g = 0; g < ret_var.datalen; g++) {
54710                 LDKPath ret_conv_6_var = ret_var.data[g];
54711                 uint64_t ret_conv_6_ref = 0;
54712                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
54713                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
54714                 ret_arr_ptr[g] = ret_conv_6_ref;
54715         }
54716         
54717         FREE(ret_var.data);
54718         return ret_arr;
54719 }
54720
54721 void  __attribute__((export_name("TS_Route_set_paths"))) TS_Route_set_paths(uint64_t this_ptr, uint64_tArray val) {
54722         LDKRoute this_ptr_conv;
54723         this_ptr_conv.inner = untag_ptr(this_ptr);
54724         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54725         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54726         this_ptr_conv.is_owned = false;
54727         LDKCVec_PathZ val_constr;
54728         val_constr.datalen = val->arr_len;
54729         if (val_constr.datalen > 0)
54730                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
54731         else
54732                 val_constr.data = NULL;
54733         uint64_t* val_vals = val->elems;
54734         for (size_t g = 0; g < val_constr.datalen; g++) {
54735                 uint64_t val_conv_6 = val_vals[g];
54736                 LDKPath val_conv_6_conv;
54737                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
54738                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
54739                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
54740                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
54741                 val_constr.data[g] = val_conv_6_conv;
54742         }
54743         FREE(val);
54744         Route_set_paths(&this_ptr_conv, val_constr);
54745 }
54746
54747 uint64_t  __attribute__((export_name("TS_Route_get_payment_params"))) TS_Route_get_payment_params(uint64_t this_ptr) {
54748         LDKRoute this_ptr_conv;
54749         this_ptr_conv.inner = untag_ptr(this_ptr);
54750         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54752         this_ptr_conv.is_owned = false;
54753         LDKPaymentParameters ret_var = Route_get_payment_params(&this_ptr_conv);
54754         uint64_t ret_ref = 0;
54755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54757         return ret_ref;
54758 }
54759
54760 void  __attribute__((export_name("TS_Route_set_payment_params"))) TS_Route_set_payment_params(uint64_t this_ptr, uint64_t val) {
54761         LDKRoute this_ptr_conv;
54762         this_ptr_conv.inner = untag_ptr(this_ptr);
54763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54765         this_ptr_conv.is_owned = false;
54766         LDKPaymentParameters val_conv;
54767         val_conv.inner = untag_ptr(val);
54768         val_conv.is_owned = ptr_is_owned(val);
54769         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54770         val_conv = PaymentParameters_clone(&val_conv);
54771         Route_set_payment_params(&this_ptr_conv, val_conv);
54772 }
54773
54774 uint64_t  __attribute__((export_name("TS_Route_new"))) TS_Route_new(uint64_tArray paths_arg, uint64_t payment_params_arg) {
54775         LDKCVec_PathZ paths_arg_constr;
54776         paths_arg_constr.datalen = paths_arg->arr_len;
54777         if (paths_arg_constr.datalen > 0)
54778                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
54779         else
54780                 paths_arg_constr.data = NULL;
54781         uint64_t* paths_arg_vals = paths_arg->elems;
54782         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
54783                 uint64_t paths_arg_conv_6 = paths_arg_vals[g];
54784                 LDKPath paths_arg_conv_6_conv;
54785                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
54786                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
54787                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
54788                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
54789                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
54790         }
54791         FREE(paths_arg);
54792         LDKPaymentParameters payment_params_arg_conv;
54793         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
54794         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
54795         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
54796         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
54797         LDKRoute ret_var = Route_new(paths_arg_constr, payment_params_arg_conv);
54798         uint64_t ret_ref = 0;
54799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54801         return ret_ref;
54802 }
54803
54804 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
54805         LDKRoute ret_var = Route_clone(arg);
54806         uint64_t ret_ref = 0;
54807         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54808         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54809         return ret_ref;
54810 }
54811 int64_t  __attribute__((export_name("TS_Route_clone_ptr"))) TS_Route_clone_ptr(uint64_t arg) {
54812         LDKRoute arg_conv;
54813         arg_conv.inner = untag_ptr(arg);
54814         arg_conv.is_owned = ptr_is_owned(arg);
54815         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54816         arg_conv.is_owned = false;
54817         int64_t ret_conv = Route_clone_ptr(&arg_conv);
54818         return ret_conv;
54819 }
54820
54821 uint64_t  __attribute__((export_name("TS_Route_clone"))) TS_Route_clone(uint64_t orig) {
54822         LDKRoute orig_conv;
54823         orig_conv.inner = untag_ptr(orig);
54824         orig_conv.is_owned = ptr_is_owned(orig);
54825         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54826         orig_conv.is_owned = false;
54827         LDKRoute ret_var = Route_clone(&orig_conv);
54828         uint64_t ret_ref = 0;
54829         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54830         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54831         return ret_ref;
54832 }
54833
54834 int64_t  __attribute__((export_name("TS_Route_hash"))) TS_Route_hash(uint64_t o) {
54835         LDKRoute o_conv;
54836         o_conv.inner = untag_ptr(o);
54837         o_conv.is_owned = ptr_is_owned(o);
54838         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54839         o_conv.is_owned = false;
54840         int64_t ret_conv = Route_hash(&o_conv);
54841         return ret_conv;
54842 }
54843
54844 jboolean  __attribute__((export_name("TS_Route_eq"))) TS_Route_eq(uint64_t a, uint64_t b) {
54845         LDKRoute a_conv;
54846         a_conv.inner = untag_ptr(a);
54847         a_conv.is_owned = ptr_is_owned(a);
54848         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54849         a_conv.is_owned = false;
54850         LDKRoute b_conv;
54851         b_conv.inner = untag_ptr(b);
54852         b_conv.is_owned = ptr_is_owned(b);
54853         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54854         b_conv.is_owned = false;
54855         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
54856         return ret_conv;
54857 }
54858
54859 int64_t  __attribute__((export_name("TS_Route_get_total_fees"))) TS_Route_get_total_fees(uint64_t this_arg) {
54860         LDKRoute this_arg_conv;
54861         this_arg_conv.inner = untag_ptr(this_arg);
54862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54864         this_arg_conv.is_owned = false;
54865         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
54866         return ret_conv;
54867 }
54868
54869 int64_t  __attribute__((export_name("TS_Route_get_total_amount"))) TS_Route_get_total_amount(uint64_t this_arg) {
54870         LDKRoute this_arg_conv;
54871         this_arg_conv.inner = untag_ptr(this_arg);
54872         this_arg_conv.is_owned = ptr_is_owned(this_arg);
54873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
54874         this_arg_conv.is_owned = false;
54875         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
54876         return ret_conv;
54877 }
54878
54879 int8_tArray  __attribute__((export_name("TS_Route_write"))) TS_Route_write(uint64_t obj) {
54880         LDKRoute obj_conv;
54881         obj_conv.inner = untag_ptr(obj);
54882         obj_conv.is_owned = ptr_is_owned(obj);
54883         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
54884         obj_conv.is_owned = false;
54885         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
54886         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
54887         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
54888         CVec_u8Z_free(ret_var);
54889         return ret_arr;
54890 }
54891
54892 uint64_t  __attribute__((export_name("TS_Route_read"))) TS_Route_read(int8_tArray ser) {
54893         LDKu8slice ser_ref;
54894         ser_ref.datalen = ser->arr_len;
54895         ser_ref.data = ser->elems;
54896         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
54897         *ret_conv = Route_read(ser_ref);
54898         FREE(ser);
54899         return tag_ptr(ret_conv, true);
54900 }
54901
54902 void  __attribute__((export_name("TS_RouteParameters_free"))) TS_RouteParameters_free(uint64_t this_obj) {
54903         LDKRouteParameters this_obj_conv;
54904         this_obj_conv.inner = untag_ptr(this_obj);
54905         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54906         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54907         RouteParameters_free(this_obj_conv);
54908 }
54909
54910 uint64_t  __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
54911         LDKRouteParameters this_ptr_conv;
54912         this_ptr_conv.inner = untag_ptr(this_ptr);
54913         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54914         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54915         this_ptr_conv.is_owned = false;
54916         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
54917         uint64_t ret_ref = 0;
54918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54920         return ret_ref;
54921 }
54922
54923 void  __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
54924         LDKRouteParameters this_ptr_conv;
54925         this_ptr_conv.inner = untag_ptr(this_ptr);
54926         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54928         this_ptr_conv.is_owned = false;
54929         LDKPaymentParameters val_conv;
54930         val_conv.inner = untag_ptr(val);
54931         val_conv.is_owned = ptr_is_owned(val);
54932         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54933         val_conv = PaymentParameters_clone(&val_conv);
54934         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
54935 }
54936
54937 int64_t  __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
54938         LDKRouteParameters this_ptr_conv;
54939         this_ptr_conv.inner = untag_ptr(this_ptr);
54940         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54941         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54942         this_ptr_conv.is_owned = false;
54943         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
54944         return ret_conv;
54945 }
54946
54947 void  __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
54948         LDKRouteParameters this_ptr_conv;
54949         this_ptr_conv.inner = untag_ptr(this_ptr);
54950         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54952         this_ptr_conv.is_owned = false;
54953         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
54954 }
54955
54956 uint64_t  __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) {
54957         LDKPaymentParameters payment_params_arg_conv;
54958         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
54959         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
54960         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
54961         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
54962         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
54963         uint64_t ret_ref = 0;
54964         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54965         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54966         return ret_ref;
54967 }
54968
54969 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
54970         LDKRouteParameters ret_var = RouteParameters_clone(arg);
54971         uint64_t ret_ref = 0;
54972         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54973         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54974         return ret_ref;
54975 }
54976 int64_t  __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
54977         LDKRouteParameters arg_conv;
54978         arg_conv.inner = untag_ptr(arg);
54979         arg_conv.is_owned = ptr_is_owned(arg);
54980         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54981         arg_conv.is_owned = false;
54982         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
54983         return ret_conv;
54984 }
54985
54986 uint64_t  __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
54987         LDKRouteParameters orig_conv;
54988         orig_conv.inner = untag_ptr(orig);
54989         orig_conv.is_owned = ptr_is_owned(orig);
54990         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54991         orig_conv.is_owned = false;
54992         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
54993         uint64_t ret_ref = 0;
54994         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54995         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54996         return ret_ref;
54997 }
54998
54999 jboolean  __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
55000         LDKRouteParameters a_conv;
55001         a_conv.inner = untag_ptr(a);
55002         a_conv.is_owned = ptr_is_owned(a);
55003         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55004         a_conv.is_owned = false;
55005         LDKRouteParameters b_conv;
55006         b_conv.inner = untag_ptr(b);
55007         b_conv.is_owned = ptr_is_owned(b);
55008         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55009         b_conv.is_owned = false;
55010         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
55011         return ret_conv;
55012 }
55013
55014 int8_tArray  __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
55015         LDKRouteParameters obj_conv;
55016         obj_conv.inner = untag_ptr(obj);
55017         obj_conv.is_owned = ptr_is_owned(obj);
55018         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55019         obj_conv.is_owned = false;
55020         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
55021         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55022         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55023         CVec_u8Z_free(ret_var);
55024         return ret_arr;
55025 }
55026
55027 uint64_t  __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
55028         LDKu8slice ser_ref;
55029         ser_ref.datalen = ser->arr_len;
55030         ser_ref.data = ser->elems;
55031         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
55032         *ret_conv = RouteParameters_read(ser_ref);
55033         FREE(ser);
55034         return tag_ptr(ret_conv, true);
55035 }
55036
55037 void  __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
55038         LDKPaymentParameters this_obj_conv;
55039         this_obj_conv.inner = untag_ptr(this_obj);
55040         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55042         PaymentParameters_free(this_obj_conv);
55043 }
55044
55045 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_payee"))) TS_PaymentParameters_get_payee(uint64_t this_ptr) {
55046         LDKPaymentParameters this_ptr_conv;
55047         this_ptr_conv.inner = untag_ptr(this_ptr);
55048         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55049         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55050         this_ptr_conv.is_owned = false;
55051         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55052         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
55053         uint64_t ret_ref = tag_ptr(ret_copy, true);
55054         return ret_ref;
55055 }
55056
55057 void  __attribute__((export_name("TS_PaymentParameters_set_payee"))) TS_PaymentParameters_set_payee(uint64_t this_ptr, uint64_t val) {
55058         LDKPaymentParameters this_ptr_conv;
55059         this_ptr_conv.inner = untag_ptr(this_ptr);
55060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55062         this_ptr_conv.is_owned = false;
55063         void* val_ptr = untag_ptr(val);
55064         CHECK_ACCESS(val_ptr);
55065         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
55066         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
55067         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
55068 }
55069
55070 uint64_t  __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
55071         LDKPaymentParameters this_ptr_conv;
55072         this_ptr_conv.inner = untag_ptr(this_ptr);
55073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55075         this_ptr_conv.is_owned = false;
55076         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55077         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
55078         uint64_t ret_ref = tag_ptr(ret_copy, true);
55079         return ret_ref;
55080 }
55081
55082 void  __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
55083         LDKPaymentParameters this_ptr_conv;
55084         this_ptr_conv.inner = untag_ptr(this_ptr);
55085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55087         this_ptr_conv.is_owned = false;
55088         void* val_ptr = untag_ptr(val);
55089         CHECK_ACCESS(val_ptr);
55090         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
55091         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
55092         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
55093 }
55094
55095 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) {
55096         LDKPaymentParameters this_ptr_conv;
55097         this_ptr_conv.inner = untag_ptr(this_ptr);
55098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55100         this_ptr_conv.is_owned = false;
55101         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
55102         return ret_conv;
55103 }
55104
55105 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) {
55106         LDKPaymentParameters this_ptr_conv;
55107         this_ptr_conv.inner = untag_ptr(this_ptr);
55108         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55110         this_ptr_conv.is_owned = false;
55111         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
55112 }
55113
55114 int8_t  __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
55115         LDKPaymentParameters this_ptr_conv;
55116         this_ptr_conv.inner = untag_ptr(this_ptr);
55117         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55119         this_ptr_conv.is_owned = false;
55120         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
55121         return ret_conv;
55122 }
55123
55124 void  __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
55125         LDKPaymentParameters this_ptr_conv;
55126         this_ptr_conv.inner = untag_ptr(this_ptr);
55127         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55129         this_ptr_conv.is_owned = false;
55130         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
55131 }
55132
55133 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) {
55134         LDKPaymentParameters this_ptr_conv;
55135         this_ptr_conv.inner = untag_ptr(this_ptr);
55136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55138         this_ptr_conv.is_owned = false;
55139         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
55140         return ret_conv;
55141 }
55142
55143 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) {
55144         LDKPaymentParameters this_ptr_conv;
55145         this_ptr_conv.inner = untag_ptr(this_ptr);
55146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55148         this_ptr_conv.is_owned = false;
55149         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
55150 }
55151
55152 int64_tArray  __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
55153         LDKPaymentParameters this_ptr_conv;
55154         this_ptr_conv.inner = untag_ptr(this_ptr);
55155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55157         this_ptr_conv.is_owned = false;
55158         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
55159         int64_tArray ret_arr = NULL;
55160         ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
55161         int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
55162         for (size_t i = 0; i < ret_var.datalen; i++) {
55163                 int64_t ret_conv_8_conv = ret_var.data[i];
55164                 ret_arr_ptr[i] = ret_conv_8_conv;
55165         }
55166         
55167         FREE(ret_var.data);
55168         return ret_arr;
55169 }
55170
55171 void  __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
55172         LDKPaymentParameters this_ptr_conv;
55173         this_ptr_conv.inner = untag_ptr(this_ptr);
55174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55176         this_ptr_conv.is_owned = false;
55177         LDKCVec_u64Z val_constr;
55178         val_constr.datalen = val->arr_len;
55179         if (val_constr.datalen > 0)
55180                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
55181         else
55182                 val_constr.data = NULL;
55183         int64_t* val_vals = val->elems;
55184         for (size_t i = 0; i < val_constr.datalen; i++) {
55185                 int64_t val_conv_8 = val_vals[i];
55186                 val_constr.data[i] = val_conv_8;
55187         }
55188         FREE(val);
55189         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
55190 }
55191
55192 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) {
55193         void* payee_arg_ptr = untag_ptr(payee_arg);
55194         CHECK_ACCESS(payee_arg_ptr);
55195         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
55196         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
55197         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
55198         CHECK_ACCESS(expiry_time_arg_ptr);
55199         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
55200         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
55201         LDKCVec_u64Z previously_failed_channels_arg_constr;
55202         previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
55203         if (previously_failed_channels_arg_constr.datalen > 0)
55204                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
55205         else
55206                 previously_failed_channels_arg_constr.data = NULL;
55207         int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
55208         for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
55209                 int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
55210                 previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
55211         }
55212         FREE(previously_failed_channels_arg);
55213         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);
55214         uint64_t ret_ref = 0;
55215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55217         return ret_ref;
55218 }
55219
55220 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
55221         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
55222         uint64_t ret_ref = 0;
55223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55225         return ret_ref;
55226 }
55227 int64_t  __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
55228         LDKPaymentParameters arg_conv;
55229         arg_conv.inner = untag_ptr(arg);
55230         arg_conv.is_owned = ptr_is_owned(arg);
55231         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55232         arg_conv.is_owned = false;
55233         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
55234         return ret_conv;
55235 }
55236
55237 uint64_t  __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
55238         LDKPaymentParameters orig_conv;
55239         orig_conv.inner = untag_ptr(orig);
55240         orig_conv.is_owned = ptr_is_owned(orig);
55241         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55242         orig_conv.is_owned = false;
55243         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
55244         uint64_t ret_ref = 0;
55245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55247         return ret_ref;
55248 }
55249
55250 int64_t  __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
55251         LDKPaymentParameters o_conv;
55252         o_conv.inner = untag_ptr(o);
55253         o_conv.is_owned = ptr_is_owned(o);
55254         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55255         o_conv.is_owned = false;
55256         int64_t ret_conv = PaymentParameters_hash(&o_conv);
55257         return ret_conv;
55258 }
55259
55260 jboolean  __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
55261         LDKPaymentParameters a_conv;
55262         a_conv.inner = untag_ptr(a);
55263         a_conv.is_owned = ptr_is_owned(a);
55264         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55265         a_conv.is_owned = false;
55266         LDKPaymentParameters b_conv;
55267         b_conv.inner = untag_ptr(b);
55268         b_conv.is_owned = ptr_is_owned(b);
55269         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55270         b_conv.is_owned = false;
55271         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
55272         return ret_conv;
55273 }
55274
55275 int8_tArray  __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
55276         LDKPaymentParameters obj_conv;
55277         obj_conv.inner = untag_ptr(obj);
55278         obj_conv.is_owned = ptr_is_owned(obj);
55279         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55280         obj_conv.is_owned = false;
55281         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
55282         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55283         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55284         CVec_u8Z_free(ret_var);
55285         return ret_arr;
55286 }
55287
55288 uint64_t  __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
55289         LDKu8slice ser_ref;
55290         ser_ref.datalen = ser->arr_len;
55291         ser_ref.data = ser->elems;
55292         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
55293         *ret_conv = PaymentParameters_read(ser_ref, arg);
55294         FREE(ser);
55295         return tag_ptr(ret_conv, true);
55296 }
55297
55298 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) {
55299         LDKPublicKey payee_pubkey_ref;
55300         CHECK(payee_pubkey->arr_len == 33);
55301         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
55302         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
55303         uint64_t ret_ref = 0;
55304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55306         return ret_ref;
55307 }
55308
55309 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) {
55310         LDKPublicKey payee_pubkey_ref;
55311         CHECK(payee_pubkey->arr_len == 33);
55312         memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
55313         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
55314         uint64_t ret_ref = 0;
55315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55317         return ret_ref;
55318 }
55319
55320 uint64_t  __attribute__((export_name("TS_PaymentParameters_from_bolt12_invoice"))) TS_PaymentParameters_from_bolt12_invoice(uint64_t invoice) {
55321         LDKBolt12Invoice invoice_conv;
55322         invoice_conv.inner = untag_ptr(invoice);
55323         invoice_conv.is_owned = ptr_is_owned(invoice);
55324         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
55325         invoice_conv.is_owned = false;
55326         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
55327         uint64_t ret_ref = 0;
55328         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55329         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55330         return ret_ref;
55331 }
55332
55333 void  __attribute__((export_name("TS_Payee_free"))) TS_Payee_free(uint64_t this_ptr) {
55334         if (!ptr_is_owned(this_ptr)) return;
55335         void* this_ptr_ptr = untag_ptr(this_ptr);
55336         CHECK_ACCESS(this_ptr_ptr);
55337         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
55338         FREE(untag_ptr(this_ptr));
55339         Payee_free(this_ptr_conv);
55340 }
55341
55342 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
55343         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55344         *ret_copy = Payee_clone(arg);
55345         uint64_t ret_ref = tag_ptr(ret_copy, true);
55346         return ret_ref;
55347 }
55348 int64_t  __attribute__((export_name("TS_Payee_clone_ptr"))) TS_Payee_clone_ptr(uint64_t arg) {
55349         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
55350         int64_t ret_conv = Payee_clone_ptr(arg_conv);
55351         return ret_conv;
55352 }
55353
55354 uint64_t  __attribute__((export_name("TS_Payee_clone"))) TS_Payee_clone(uint64_t orig) {
55355         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
55356         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55357         *ret_copy = Payee_clone(orig_conv);
55358         uint64_t ret_ref = tag_ptr(ret_copy, true);
55359         return ret_ref;
55360 }
55361
55362 uint64_t  __attribute__((export_name("TS_Payee_blinded"))) TS_Payee_blinded(uint64_tArray route_hints, uint64_t features) {
55363         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
55364         route_hints_constr.datalen = route_hints->arr_len;
55365         if (route_hints_constr.datalen > 0)
55366                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
55367         else
55368                 route_hints_constr.data = NULL;
55369         uint64_t* route_hints_vals = route_hints->elems;
55370         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
55371                 uint64_t route_hints_conv_37 = route_hints_vals[l];
55372                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
55373                 CHECK_ACCESS(route_hints_conv_37_ptr);
55374                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
55375                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
55376                 route_hints_constr.data[l] = route_hints_conv_37_conv;
55377         }
55378         FREE(route_hints);
55379         LDKBolt12InvoiceFeatures features_conv;
55380         features_conv.inner = untag_ptr(features);
55381         features_conv.is_owned = ptr_is_owned(features);
55382         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
55383         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
55384         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55385         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
55386         uint64_t ret_ref = tag_ptr(ret_copy, true);
55387         return ret_ref;
55388 }
55389
55390 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) {
55391         LDKPublicKey node_id_ref;
55392         CHECK(node_id->arr_len == 33);
55393         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
55394         LDKCVec_RouteHintZ route_hints_constr;
55395         route_hints_constr.datalen = route_hints->arr_len;
55396         if (route_hints_constr.datalen > 0)
55397                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
55398         else
55399                 route_hints_constr.data = NULL;
55400         uint64_t* route_hints_vals = route_hints->elems;
55401         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
55402                 uint64_t route_hints_conv_11 = route_hints_vals[l];
55403                 LDKRouteHint route_hints_conv_11_conv;
55404                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
55405                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
55406                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
55407                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
55408                 route_hints_constr.data[l] = route_hints_conv_11_conv;
55409         }
55410         FREE(route_hints);
55411         LDKBolt11InvoiceFeatures features_conv;
55412         features_conv.inner = untag_ptr(features);
55413         features_conv.is_owned = ptr_is_owned(features);
55414         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
55415         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
55416         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
55417         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
55418         uint64_t ret_ref = tag_ptr(ret_copy, true);
55419         return ret_ref;
55420 }
55421
55422 int64_t  __attribute__((export_name("TS_Payee_hash"))) TS_Payee_hash(uint64_t o) {
55423         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
55424         int64_t ret_conv = Payee_hash(o_conv);
55425         return ret_conv;
55426 }
55427
55428 jboolean  __attribute__((export_name("TS_Payee_eq"))) TS_Payee_eq(uint64_t a, uint64_t b) {
55429         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
55430         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
55431         jboolean ret_conv = Payee_eq(a_conv, b_conv);
55432         return ret_conv;
55433 }
55434
55435 void  __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
55436         LDKRouteHint this_obj_conv;
55437         this_obj_conv.inner = untag_ptr(this_obj);
55438         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55440         RouteHint_free(this_obj_conv);
55441 }
55442
55443 uint64_tArray  __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
55444         LDKRouteHint this_ptr_conv;
55445         this_ptr_conv.inner = untag_ptr(this_ptr);
55446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55448         this_ptr_conv.is_owned = false;
55449         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
55450         uint64_tArray ret_arr = NULL;
55451         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
55452         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
55453         for (size_t o = 0; o < ret_var.datalen; o++) {
55454                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
55455                 uint64_t ret_conv_14_ref = 0;
55456                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
55457                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
55458                 ret_arr_ptr[o] = ret_conv_14_ref;
55459         }
55460         
55461         FREE(ret_var.data);
55462         return ret_arr;
55463 }
55464
55465 void  __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
55466         LDKRouteHint this_ptr_conv;
55467         this_ptr_conv.inner = untag_ptr(this_ptr);
55468         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55470         this_ptr_conv.is_owned = false;
55471         LDKCVec_RouteHintHopZ val_constr;
55472         val_constr.datalen = val->arr_len;
55473         if (val_constr.datalen > 0)
55474                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
55475         else
55476                 val_constr.data = NULL;
55477         uint64_t* val_vals = val->elems;
55478         for (size_t o = 0; o < val_constr.datalen; o++) {
55479                 uint64_t val_conv_14 = val_vals[o];
55480                 LDKRouteHintHop val_conv_14_conv;
55481                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
55482                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
55483                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
55484                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
55485                 val_constr.data[o] = val_conv_14_conv;
55486         }
55487         FREE(val);
55488         RouteHint_set_a(&this_ptr_conv, val_constr);
55489 }
55490
55491 uint64_t  __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
55492         LDKCVec_RouteHintHopZ a_arg_constr;
55493         a_arg_constr.datalen = a_arg->arr_len;
55494         if (a_arg_constr.datalen > 0)
55495                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
55496         else
55497                 a_arg_constr.data = NULL;
55498         uint64_t* a_arg_vals = a_arg->elems;
55499         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
55500                 uint64_t a_arg_conv_14 = a_arg_vals[o];
55501                 LDKRouteHintHop a_arg_conv_14_conv;
55502                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
55503                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
55504                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
55505                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
55506                 a_arg_constr.data[o] = a_arg_conv_14_conv;
55507         }
55508         FREE(a_arg);
55509         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
55510         uint64_t ret_ref = 0;
55511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55513         return ret_ref;
55514 }
55515
55516 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
55517         LDKRouteHint ret_var = RouteHint_clone(arg);
55518         uint64_t ret_ref = 0;
55519         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55520         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55521         return ret_ref;
55522 }
55523 int64_t  __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
55524         LDKRouteHint arg_conv;
55525         arg_conv.inner = untag_ptr(arg);
55526         arg_conv.is_owned = ptr_is_owned(arg);
55527         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55528         arg_conv.is_owned = false;
55529         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
55530         return ret_conv;
55531 }
55532
55533 uint64_t  __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
55534         LDKRouteHint orig_conv;
55535         orig_conv.inner = untag_ptr(orig);
55536         orig_conv.is_owned = ptr_is_owned(orig);
55537         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55538         orig_conv.is_owned = false;
55539         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
55540         uint64_t ret_ref = 0;
55541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55543         return ret_ref;
55544 }
55545
55546 int64_t  __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
55547         LDKRouteHint o_conv;
55548         o_conv.inner = untag_ptr(o);
55549         o_conv.is_owned = ptr_is_owned(o);
55550         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55551         o_conv.is_owned = false;
55552         int64_t ret_conv = RouteHint_hash(&o_conv);
55553         return ret_conv;
55554 }
55555
55556 jboolean  __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
55557         LDKRouteHint a_conv;
55558         a_conv.inner = untag_ptr(a);
55559         a_conv.is_owned = ptr_is_owned(a);
55560         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55561         a_conv.is_owned = false;
55562         LDKRouteHint b_conv;
55563         b_conv.inner = untag_ptr(b);
55564         b_conv.is_owned = ptr_is_owned(b);
55565         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55566         b_conv.is_owned = false;
55567         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
55568         return ret_conv;
55569 }
55570
55571 int8_tArray  __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
55572         LDKRouteHint obj_conv;
55573         obj_conv.inner = untag_ptr(obj);
55574         obj_conv.is_owned = ptr_is_owned(obj);
55575         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55576         obj_conv.is_owned = false;
55577         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
55578         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55579         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55580         CVec_u8Z_free(ret_var);
55581         return ret_arr;
55582 }
55583
55584 uint64_t  __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
55585         LDKu8slice ser_ref;
55586         ser_ref.datalen = ser->arr_len;
55587         ser_ref.data = ser->elems;
55588         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
55589         *ret_conv = RouteHint_read(ser_ref);
55590         FREE(ser);
55591         return tag_ptr(ret_conv, true);
55592 }
55593
55594 void  __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
55595         LDKRouteHintHop this_obj_conv;
55596         this_obj_conv.inner = untag_ptr(this_obj);
55597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55599         RouteHintHop_free(this_obj_conv);
55600 }
55601
55602 int8_tArray  __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
55603         LDKRouteHintHop this_ptr_conv;
55604         this_ptr_conv.inner = untag_ptr(this_ptr);
55605         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55607         this_ptr_conv.is_owned = false;
55608         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
55609         memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
55610         return ret_arr;
55611 }
55612
55613 void  __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
55614         LDKRouteHintHop this_ptr_conv;
55615         this_ptr_conv.inner = untag_ptr(this_ptr);
55616         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55618         this_ptr_conv.is_owned = false;
55619         LDKPublicKey val_ref;
55620         CHECK(val->arr_len == 33);
55621         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
55622         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
55623 }
55624
55625 int64_t  __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
55626         LDKRouteHintHop this_ptr_conv;
55627         this_ptr_conv.inner = untag_ptr(this_ptr);
55628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55630         this_ptr_conv.is_owned = false;
55631         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
55632         return ret_conv;
55633 }
55634
55635 void  __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
55636         LDKRouteHintHop this_ptr_conv;
55637         this_ptr_conv.inner = untag_ptr(this_ptr);
55638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55640         this_ptr_conv.is_owned = false;
55641         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
55642 }
55643
55644 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
55645         LDKRouteHintHop this_ptr_conv;
55646         this_ptr_conv.inner = untag_ptr(this_ptr);
55647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55649         this_ptr_conv.is_owned = false;
55650         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
55651         uint64_t ret_ref = 0;
55652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55654         return ret_ref;
55655 }
55656
55657 void  __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
55658         LDKRouteHintHop this_ptr_conv;
55659         this_ptr_conv.inner = untag_ptr(this_ptr);
55660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55662         this_ptr_conv.is_owned = false;
55663         LDKRoutingFees val_conv;
55664         val_conv.inner = untag_ptr(val);
55665         val_conv.is_owned = ptr_is_owned(val);
55666         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55667         val_conv = RoutingFees_clone(&val_conv);
55668         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
55669 }
55670
55671 int16_t  __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
55672         LDKRouteHintHop this_ptr_conv;
55673         this_ptr_conv.inner = untag_ptr(this_ptr);
55674         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55676         this_ptr_conv.is_owned = false;
55677         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
55678         return ret_conv;
55679 }
55680
55681 void  __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
55682         LDKRouteHintHop this_ptr_conv;
55683         this_ptr_conv.inner = untag_ptr(this_ptr);
55684         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55685         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55686         this_ptr_conv.is_owned = false;
55687         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
55688 }
55689
55690 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
55691         LDKRouteHintHop this_ptr_conv;
55692         this_ptr_conv.inner = untag_ptr(this_ptr);
55693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55695         this_ptr_conv.is_owned = false;
55696         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55697         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
55698         uint64_t ret_ref = tag_ptr(ret_copy, true);
55699         return ret_ref;
55700 }
55701
55702 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
55703         LDKRouteHintHop this_ptr_conv;
55704         this_ptr_conv.inner = untag_ptr(this_ptr);
55705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55707         this_ptr_conv.is_owned = false;
55708         void* val_ptr = untag_ptr(val);
55709         CHECK_ACCESS(val_ptr);
55710         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
55711         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
55712         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
55713 }
55714
55715 uint64_t  __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
55716         LDKRouteHintHop this_ptr_conv;
55717         this_ptr_conv.inner = untag_ptr(this_ptr);
55718         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55719         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55720         this_ptr_conv.is_owned = false;
55721         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55722         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
55723         uint64_t ret_ref = tag_ptr(ret_copy, true);
55724         return ret_ref;
55725 }
55726
55727 void  __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
55728         LDKRouteHintHop this_ptr_conv;
55729         this_ptr_conv.inner = untag_ptr(this_ptr);
55730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55732         this_ptr_conv.is_owned = false;
55733         void* val_ptr = untag_ptr(val);
55734         CHECK_ACCESS(val_ptr);
55735         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
55736         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
55737         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
55738 }
55739
55740 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) {
55741         LDKPublicKey src_node_id_arg_ref;
55742         CHECK(src_node_id_arg->arr_len == 33);
55743         memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
55744         LDKRoutingFees fees_arg_conv;
55745         fees_arg_conv.inner = untag_ptr(fees_arg);
55746         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
55747         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
55748         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
55749         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
55750         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
55751         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
55752         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
55753         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
55754         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
55755         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
55756         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
55757         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);
55758         uint64_t ret_ref = 0;
55759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55761         return ret_ref;
55762 }
55763
55764 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
55765         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
55766         uint64_t ret_ref = 0;
55767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55769         return ret_ref;
55770 }
55771 int64_t  __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
55772         LDKRouteHintHop arg_conv;
55773         arg_conv.inner = untag_ptr(arg);
55774         arg_conv.is_owned = ptr_is_owned(arg);
55775         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55776         arg_conv.is_owned = false;
55777         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
55778         return ret_conv;
55779 }
55780
55781 uint64_t  __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
55782         LDKRouteHintHop orig_conv;
55783         orig_conv.inner = untag_ptr(orig);
55784         orig_conv.is_owned = ptr_is_owned(orig);
55785         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55786         orig_conv.is_owned = false;
55787         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
55788         uint64_t ret_ref = 0;
55789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55791         return ret_ref;
55792 }
55793
55794 int64_t  __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
55795         LDKRouteHintHop o_conv;
55796         o_conv.inner = untag_ptr(o);
55797         o_conv.is_owned = ptr_is_owned(o);
55798         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55799         o_conv.is_owned = false;
55800         int64_t ret_conv = RouteHintHop_hash(&o_conv);
55801         return ret_conv;
55802 }
55803
55804 jboolean  __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
55805         LDKRouteHintHop a_conv;
55806         a_conv.inner = untag_ptr(a);
55807         a_conv.is_owned = ptr_is_owned(a);
55808         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55809         a_conv.is_owned = false;
55810         LDKRouteHintHop b_conv;
55811         b_conv.inner = untag_ptr(b);
55812         b_conv.is_owned = ptr_is_owned(b);
55813         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55814         b_conv.is_owned = false;
55815         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
55816         return ret_conv;
55817 }
55818
55819 int8_tArray  __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
55820         LDKRouteHintHop obj_conv;
55821         obj_conv.inner = untag_ptr(obj);
55822         obj_conv.is_owned = ptr_is_owned(obj);
55823         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55824         obj_conv.is_owned = false;
55825         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
55826         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
55827         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
55828         CVec_u8Z_free(ret_var);
55829         return ret_arr;
55830 }
55831
55832 uint64_t  __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
55833         LDKu8slice ser_ref;
55834         ser_ref.datalen = ser->arr_len;
55835         ser_ref.data = ser->elems;
55836         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
55837         *ret_conv = RouteHintHop_read(ser_ref);
55838         FREE(ser);
55839         return tag_ptr(ret_conv, true);
55840 }
55841
55842 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) {
55843         LDKPublicKey our_node_pubkey_ref;
55844         CHECK(our_node_pubkey->arr_len == 33);
55845         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
55846         LDKRouteParameters route_params_conv;
55847         route_params_conv.inner = untag_ptr(route_params);
55848         route_params_conv.is_owned = ptr_is_owned(route_params);
55849         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
55850         route_params_conv.is_owned = false;
55851         LDKNetworkGraph network_graph_conv;
55852         network_graph_conv.inner = untag_ptr(network_graph);
55853         network_graph_conv.is_owned = ptr_is_owned(network_graph);
55854         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
55855         network_graph_conv.is_owned = false;
55856         LDKCVec_ChannelDetailsZ first_hops_constr;
55857         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
55858         if (first_hops != 0) {
55859                 first_hops_constr.datalen = first_hops->arr_len;
55860                 if (first_hops_constr.datalen > 0)
55861                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
55862                 else
55863                         first_hops_constr.data = NULL;
55864                 uint64_t* first_hops_vals = first_hops->elems;
55865                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
55866                         uint64_t first_hops_conv_16 = first_hops_vals[q];
55867                         LDKChannelDetails first_hops_conv_16_conv;
55868                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
55869                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
55870                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
55871                         first_hops_conv_16_conv.is_owned = false;
55872                         first_hops_constr.data[q] = first_hops_conv_16_conv;
55873                 }
55874                 FREE(first_hops);
55875                 first_hops_ptr = &first_hops_constr;
55876         }
55877         void* logger_ptr = untag_ptr(logger);
55878         CHECK_ACCESS(logger_ptr);
55879         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
55880         if (logger_conv.free == LDKLogger_JCalls_free) {
55881                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55882                 LDKLogger_JCalls_cloned(&logger_conv);
55883         }
55884         void* scorer_ptr = untag_ptr(scorer);
55885         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
55886         LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
55887         LDKProbabilisticScoringFeeParameters score_params_conv;
55888         score_params_conv.inner = untag_ptr(score_params);
55889         score_params_conv.is_owned = ptr_is_owned(score_params);
55890         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
55891         score_params_conv.is_owned = false;
55892         uint8_t random_seed_bytes_arr[32];
55893         CHECK(random_seed_bytes->arr_len == 32);
55894         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
55895         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
55896         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
55897         *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);
55898         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
55899         return tag_ptr(ret_conv, true);
55900 }
55901
55902 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) {
55903         LDKPublicKey our_node_pubkey_ref;
55904         CHECK(our_node_pubkey->arr_len == 33);
55905         memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
55906         LDKCVec_PublicKeyZ hops_constr;
55907         hops_constr.datalen = hops->arr_len;
55908         if (hops_constr.datalen > 0)
55909                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
55910         else
55911                 hops_constr.data = NULL;
55912         int8_tArray* hops_vals = (void*) hops->elems;
55913         for (size_t m = 0; m < hops_constr.datalen; m++) {
55914                 int8_tArray hops_conv_12 = hops_vals[m];
55915                 LDKPublicKey hops_conv_12_ref;
55916                 CHECK(hops_conv_12->arr_len == 33);
55917                 memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
55918                 hops_constr.data[m] = hops_conv_12_ref;
55919         }
55920         FREE(hops);
55921         LDKRouteParameters route_params_conv;
55922         route_params_conv.inner = untag_ptr(route_params);
55923         route_params_conv.is_owned = ptr_is_owned(route_params);
55924         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
55925         route_params_conv.is_owned = false;
55926         LDKNetworkGraph network_graph_conv;
55927         network_graph_conv.inner = untag_ptr(network_graph);
55928         network_graph_conv.is_owned = ptr_is_owned(network_graph);
55929         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
55930         network_graph_conv.is_owned = false;
55931         void* logger_ptr = untag_ptr(logger);
55932         CHECK_ACCESS(logger_ptr);
55933         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
55934         if (logger_conv.free == LDKLogger_JCalls_free) {
55935                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
55936                 LDKLogger_JCalls_cloned(&logger_conv);
55937         }
55938         uint8_t random_seed_bytes_arr[32];
55939         CHECK(random_seed_bytes->arr_len == 32);
55940         memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
55941         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
55942         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
55943         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
55944         return tag_ptr(ret_conv, true);
55945 }
55946
55947 void  __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
55948         if (!ptr_is_owned(this_ptr)) return;
55949         void* this_ptr_ptr = untag_ptr(this_ptr);
55950         CHECK_ACCESS(this_ptr_ptr);
55951         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
55952         FREE(untag_ptr(this_ptr));
55953         Score_free(this_ptr_conv);
55954 }
55955
55956 void  __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
55957         if (!ptr_is_owned(this_ptr)) return;
55958         void* this_ptr_ptr = untag_ptr(this_ptr);
55959         CHECK_ACCESS(this_ptr_ptr);
55960         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
55961         FREE(untag_ptr(this_ptr));
55962         LockableScore_free(this_ptr_conv);
55963 }
55964
55965 void  __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
55966         if (!ptr_is_owned(this_ptr)) return;
55967         void* this_ptr_ptr = untag_ptr(this_ptr);
55968         CHECK_ACCESS(this_ptr_ptr);
55969         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
55970         FREE(untag_ptr(this_ptr));
55971         WriteableScore_free(this_ptr_conv);
55972 }
55973
55974 void  __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
55975         LDKMultiThreadedLockableScore this_obj_conv;
55976         this_obj_conv.inner = untag_ptr(this_obj);
55977         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55978         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55979         MultiThreadedLockableScore_free(this_obj_conv);
55980 }
55981
55982 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
55983         LDKMultiThreadedLockableScore this_arg_conv;
55984         this_arg_conv.inner = untag_ptr(this_arg);
55985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
55986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
55987         this_arg_conv.is_owned = false;
55988         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
55989         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
55990         return tag_ptr(ret_ret, true);
55991 }
55992
55993 int8_tArray  __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
55994         LDKMultiThreadedLockableScore obj_conv;
55995         obj_conv.inner = untag_ptr(obj);
55996         obj_conv.is_owned = ptr_is_owned(obj);
55997         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
55998         obj_conv.is_owned = false;
55999         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
56000         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56001         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56002         CVec_u8Z_free(ret_var);
56003         return ret_arr;
56004 }
56005
56006 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
56007         LDKMultiThreadedLockableScore this_arg_conv;
56008         this_arg_conv.inner = untag_ptr(this_arg);
56009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56011         this_arg_conv.is_owned = false;
56012         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
56013         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
56014         return tag_ptr(ret_ret, true);
56015 }
56016
56017 uint64_t  __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
56018         void* score_ptr = untag_ptr(score);
56019         CHECK_ACCESS(score_ptr);
56020         LDKScore score_conv = *(LDKScore*)(score_ptr);
56021         if (score_conv.free == LDKScore_JCalls_free) {
56022                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56023                 LDKScore_JCalls_cloned(&score_conv);
56024         }
56025         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
56026         uint64_t ret_ref = 0;
56027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56029         return ret_ref;
56030 }
56031
56032 void  __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
56033         LDKMultiThreadedScoreLock this_obj_conv;
56034         this_obj_conv.inner = untag_ptr(this_obj);
56035         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56037         MultiThreadedScoreLock_free(this_obj_conv);
56038 }
56039
56040 int8_tArray  __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
56041         LDKMultiThreadedScoreLock obj_conv;
56042         obj_conv.inner = untag_ptr(obj);
56043         obj_conv.is_owned = ptr_is_owned(obj);
56044         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56045         obj_conv.is_owned = false;
56046         LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
56047         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56048         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56049         CVec_u8Z_free(ret_var);
56050         return ret_arr;
56051 }
56052
56053 uint64_t  __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
56054         LDKMultiThreadedScoreLock this_arg_conv;
56055         this_arg_conv.inner = untag_ptr(this_arg);
56056         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56058         this_arg_conv.is_owned = false;
56059         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
56060         *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
56061         return tag_ptr(ret_ret, true);
56062 }
56063
56064 void  __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
56065         LDKChannelUsage this_obj_conv;
56066         this_obj_conv.inner = untag_ptr(this_obj);
56067         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56068         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56069         ChannelUsage_free(this_obj_conv);
56070 }
56071
56072 int64_t  __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
56073         LDKChannelUsage this_ptr_conv;
56074         this_ptr_conv.inner = untag_ptr(this_ptr);
56075         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56076         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56077         this_ptr_conv.is_owned = false;
56078         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
56079         return ret_conv;
56080 }
56081
56082 void  __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
56083         LDKChannelUsage this_ptr_conv;
56084         this_ptr_conv.inner = untag_ptr(this_ptr);
56085         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56086         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56087         this_ptr_conv.is_owned = false;
56088         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
56089 }
56090
56091 int64_t  __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
56092         LDKChannelUsage this_ptr_conv;
56093         this_ptr_conv.inner = untag_ptr(this_ptr);
56094         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56096         this_ptr_conv.is_owned = false;
56097         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
56098         return ret_conv;
56099 }
56100
56101 void  __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
56102         LDKChannelUsage this_ptr_conv;
56103         this_ptr_conv.inner = untag_ptr(this_ptr);
56104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56106         this_ptr_conv.is_owned = false;
56107         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
56108 }
56109
56110 uint64_t  __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
56111         LDKChannelUsage this_ptr_conv;
56112         this_ptr_conv.inner = untag_ptr(this_ptr);
56113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56115         this_ptr_conv.is_owned = false;
56116         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
56117         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
56118         uint64_t ret_ref = tag_ptr(ret_copy, true);
56119         return ret_ref;
56120 }
56121
56122 void  __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
56123         LDKChannelUsage this_ptr_conv;
56124         this_ptr_conv.inner = untag_ptr(this_ptr);
56125         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56126         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56127         this_ptr_conv.is_owned = false;
56128         void* val_ptr = untag_ptr(val);
56129         CHECK_ACCESS(val_ptr);
56130         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
56131         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
56132         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
56133 }
56134
56135 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) {
56136         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
56137         CHECK_ACCESS(effective_capacity_arg_ptr);
56138         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
56139         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
56140         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
56141         uint64_t ret_ref = 0;
56142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56144         return ret_ref;
56145 }
56146
56147 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
56148         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
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 int64_t  __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
56155         LDKChannelUsage arg_conv;
56156         arg_conv.inner = untag_ptr(arg);
56157         arg_conv.is_owned = ptr_is_owned(arg);
56158         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56159         arg_conv.is_owned = false;
56160         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
56161         return ret_conv;
56162 }
56163
56164 uint64_t  __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
56165         LDKChannelUsage orig_conv;
56166         orig_conv.inner = untag_ptr(orig);
56167         orig_conv.is_owned = ptr_is_owned(orig);
56168         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56169         orig_conv.is_owned = false;
56170         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
56171         uint64_t ret_ref = 0;
56172         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56173         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56174         return ret_ref;
56175 }
56176
56177 void  __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
56178         LDKFixedPenaltyScorer this_obj_conv;
56179         this_obj_conv.inner = untag_ptr(this_obj);
56180         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56182         FixedPenaltyScorer_free(this_obj_conv);
56183 }
56184
56185 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
56186         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
56187         uint64_t ret_ref = 0;
56188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56190         return ret_ref;
56191 }
56192 int64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
56193         LDKFixedPenaltyScorer arg_conv;
56194         arg_conv.inner = untag_ptr(arg);
56195         arg_conv.is_owned = ptr_is_owned(arg);
56196         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56197         arg_conv.is_owned = false;
56198         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
56199         return ret_conv;
56200 }
56201
56202 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
56203         LDKFixedPenaltyScorer orig_conv;
56204         orig_conv.inner = untag_ptr(orig);
56205         orig_conv.is_owned = ptr_is_owned(orig);
56206         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56207         orig_conv.is_owned = false;
56208         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
56209         uint64_t ret_ref = 0;
56210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56212         return ret_ref;
56213 }
56214
56215 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
56216         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
56217         uint64_t ret_ref = 0;
56218         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56219         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56220         return ret_ref;
56221 }
56222
56223 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
56224         LDKFixedPenaltyScorer this_arg_conv;
56225         this_arg_conv.inner = untag_ptr(this_arg);
56226         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56228         this_arg_conv.is_owned = false;
56229         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
56230         *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
56231         return tag_ptr(ret_ret, true);
56232 }
56233
56234 int8_tArray  __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
56235         LDKFixedPenaltyScorer obj_conv;
56236         obj_conv.inner = untag_ptr(obj);
56237         obj_conv.is_owned = ptr_is_owned(obj);
56238         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56239         obj_conv.is_owned = false;
56240         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
56241         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56242         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56243         CVec_u8Z_free(ret_var);
56244         return ret_arr;
56245 }
56246
56247 uint64_t  __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
56248         LDKu8slice ser_ref;
56249         ser_ref.datalen = ser->arr_len;
56250         ser_ref.data = ser->elems;
56251         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
56252         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
56253         FREE(ser);
56254         return tag_ptr(ret_conv, true);
56255 }
56256
56257 void  __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
56258         LDKProbabilisticScorer this_obj_conv;
56259         this_obj_conv.inner = untag_ptr(this_obj);
56260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56262         ProbabilisticScorer_free(this_obj_conv);
56263 }
56264
56265 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_free"))) TS_ProbabilisticScoringFeeParameters_free(uint64_t this_obj) {
56266         LDKProbabilisticScoringFeeParameters this_obj_conv;
56267         this_obj_conv.inner = untag_ptr(this_obj);
56268         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56270         ProbabilisticScoringFeeParameters_free(this_obj_conv);
56271 }
56272
56273 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_base_penalty_msat(uint64_t this_ptr) {
56274         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56275         this_ptr_conv.inner = untag_ptr(this_ptr);
56276         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56278         this_ptr_conv.is_owned = false;
56279         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
56280         return ret_conv;
56281 }
56282
56283 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
56284         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56285         this_ptr_conv.inner = untag_ptr(this_ptr);
56286         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56287         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56288         this_ptr_conv.is_owned = false;
56289         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
56290 }
56291
56292 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) {
56293         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56294         this_ptr_conv.inner = untag_ptr(this_ptr);
56295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56297         this_ptr_conv.is_owned = false;
56298         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
56299         return ret_conv;
56300 }
56301
56302 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) {
56303         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56304         this_ptr_conv.inner = untag_ptr(this_ptr);
56305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56307         this_ptr_conv.is_owned = false;
56308         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
56309 }
56310
56311 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
56312         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56313         this_ptr_conv.inner = untag_ptr(this_ptr);
56314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56316         this_ptr_conv.is_owned = false;
56317         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
56318         return ret_conv;
56319 }
56320
56321 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) {
56322         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56323         this_ptr_conv.inner = untag_ptr(this_ptr);
56324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56326         this_ptr_conv.is_owned = false;
56327         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
56328 }
56329
56330 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) {
56331         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56332         this_ptr_conv.inner = untag_ptr(this_ptr);
56333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56335         this_ptr_conv.is_owned = false;
56336         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
56337         return ret_conv;
56338 }
56339
56340 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) {
56341         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56342         this_ptr_conv.inner = untag_ptr(this_ptr);
56343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56345         this_ptr_conv.is_owned = false;
56346         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
56347 }
56348
56349 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) {
56350         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56351         this_ptr_conv.inner = untag_ptr(this_ptr);
56352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56354         this_ptr_conv.is_owned = false;
56355         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
56356         return ret_conv;
56357 }
56358
56359 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) {
56360         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56361         this_ptr_conv.inner = untag_ptr(this_ptr);
56362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56364         this_ptr_conv.is_owned = false;
56365         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
56366 }
56367
56368 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) {
56369         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56370         this_ptr_conv.inner = untag_ptr(this_ptr);
56371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56373         this_ptr_conv.is_owned = false;
56374         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
56375         return ret_conv;
56376 }
56377
56378 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) {
56379         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56380         this_ptr_conv.inner = untag_ptr(this_ptr);
56381         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56382         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56383         this_ptr_conv.is_owned = false;
56384         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
56385 }
56386
56387 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
56388         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56389         this_ptr_conv.inner = untag_ptr(this_ptr);
56390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56392         this_ptr_conv.is_owned = false;
56393         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
56394         return ret_conv;
56395 }
56396
56397 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) {
56398         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56399         this_ptr_conv.inner = untag_ptr(this_ptr);
56400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56402         this_ptr_conv.is_owned = false;
56403         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
56404 }
56405
56406 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
56407         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56408         this_ptr_conv.inner = untag_ptr(this_ptr);
56409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56411         this_ptr_conv.is_owned = false;
56412         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
56413         return ret_conv;
56414 }
56415
56416 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) {
56417         LDKProbabilisticScoringFeeParameters this_ptr_conv;
56418         this_ptr_conv.inner = untag_ptr(this_ptr);
56419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56421         this_ptr_conv.is_owned = false;
56422         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
56423 }
56424
56425 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
56426         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
56427         uint64_t ret_ref = 0;
56428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56430         return ret_ref;
56431 }
56432 int64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone_ptr"))) TS_ProbabilisticScoringFeeParameters_clone_ptr(uint64_t arg) {
56433         LDKProbabilisticScoringFeeParameters arg_conv;
56434         arg_conv.inner = untag_ptr(arg);
56435         arg_conv.is_owned = ptr_is_owned(arg);
56436         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56437         arg_conv.is_owned = false;
56438         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
56439         return ret_conv;
56440 }
56441
56442 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clone"))) TS_ProbabilisticScoringFeeParameters_clone(uint64_t orig) {
56443         LDKProbabilisticScoringFeeParameters orig_conv;
56444         orig_conv.inner = untag_ptr(orig);
56445         orig_conv.is_owned = ptr_is_owned(orig);
56446         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56447         orig_conv.is_owned = false;
56448         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
56449         uint64_t ret_ref = 0;
56450         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56451         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56452         return ret_ref;
56453 }
56454
56455 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_default"))) TS_ProbabilisticScoringFeeParameters_default() {
56456         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
56457         uint64_t ret_ref = 0;
56458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56460         return ret_ref;
56461 }
56462
56463 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned"))) TS_ProbabilisticScoringFeeParameters_add_banned(uint64_t this_arg, uint64_t node_id) {
56464         LDKProbabilisticScoringFeeParameters this_arg_conv;
56465         this_arg_conv.inner = untag_ptr(this_arg);
56466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56468         this_arg_conv.is_owned = false;
56469         LDKNodeId node_id_conv;
56470         node_id_conv.inner = untag_ptr(node_id);
56471         node_id_conv.is_owned = ptr_is_owned(node_id);
56472         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
56473         node_id_conv.is_owned = false;
56474         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
56475 }
56476
56477 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_add_banned_from_list"))) TS_ProbabilisticScoringFeeParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
56478         LDKProbabilisticScoringFeeParameters this_arg_conv;
56479         this_arg_conv.inner = untag_ptr(this_arg);
56480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56482         this_arg_conv.is_owned = false;
56483         LDKCVec_NodeIdZ node_ids_constr;
56484         node_ids_constr.datalen = node_ids->arr_len;
56485         if (node_ids_constr.datalen > 0)
56486                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
56487         else
56488                 node_ids_constr.data = NULL;
56489         uint64_t* node_ids_vals = node_ids->elems;
56490         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
56491                 uint64_t node_ids_conv_8 = node_ids_vals[i];
56492                 LDKNodeId node_ids_conv_8_conv;
56493                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
56494                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
56495                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
56496                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
56497                 node_ids_constr.data[i] = node_ids_conv_8_conv;
56498         }
56499         FREE(node_ids);
56500         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
56501 }
56502
56503 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_banned"))) TS_ProbabilisticScoringFeeParameters_remove_banned(uint64_t this_arg, uint64_t node_id) {
56504         LDKProbabilisticScoringFeeParameters this_arg_conv;
56505         this_arg_conv.inner = untag_ptr(this_arg);
56506         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56508         this_arg_conv.is_owned = false;
56509         LDKNodeId node_id_conv;
56510         node_id_conv.inner = untag_ptr(node_id);
56511         node_id_conv.is_owned = ptr_is_owned(node_id);
56512         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
56513         node_id_conv.is_owned = false;
56514         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
56515 }
56516
56517 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) {
56518         LDKProbabilisticScoringFeeParameters this_arg_conv;
56519         this_arg_conv.inner = untag_ptr(this_arg);
56520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56522         this_arg_conv.is_owned = false;
56523         LDKNodeId node_id_conv;
56524         node_id_conv.inner = untag_ptr(node_id);
56525         node_id_conv.is_owned = ptr_is_owned(node_id);
56526         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
56527         node_id_conv.is_owned = false;
56528         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
56529 }
56530
56531 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_remove_manual_penalty"))) TS_ProbabilisticScoringFeeParameters_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
56532         LDKProbabilisticScoringFeeParameters this_arg_conv;
56533         this_arg_conv.inner = untag_ptr(this_arg);
56534         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56536         this_arg_conv.is_owned = false;
56537         LDKNodeId node_id_conv;
56538         node_id_conv.inner = untag_ptr(node_id);
56539         node_id_conv.is_owned = ptr_is_owned(node_id);
56540         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
56541         node_id_conv.is_owned = false;
56542         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
56543 }
56544
56545 void  __attribute__((export_name("TS_ProbabilisticScoringFeeParameters_clear_manual_penalties"))) TS_ProbabilisticScoringFeeParameters_clear_manual_penalties(uint64_t this_arg) {
56546         LDKProbabilisticScoringFeeParameters this_arg_conv;
56547         this_arg_conv.inner = untag_ptr(this_arg);
56548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56550         this_arg_conv.is_owned = false;
56551         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
56552 }
56553
56554 void  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_free"))) TS_ProbabilisticScoringDecayParameters_free(uint64_t this_obj) {
56555         LDKProbabilisticScoringDecayParameters this_obj_conv;
56556         this_obj_conv.inner = untag_ptr(this_obj);
56557         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56559         ProbabilisticScoringDecayParameters_free(this_obj_conv);
56560 }
56561
56562 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) {
56563         LDKProbabilisticScoringDecayParameters this_ptr_conv;
56564         this_ptr_conv.inner = untag_ptr(this_ptr);
56565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56567         this_ptr_conv.is_owned = false;
56568         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
56569         return ret_conv;
56570 }
56571
56572 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) {
56573         LDKProbabilisticScoringDecayParameters this_ptr_conv;
56574         this_ptr_conv.inner = untag_ptr(this_ptr);
56575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56577         this_ptr_conv.is_owned = false;
56578         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
56579 }
56580
56581 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
56582         LDKProbabilisticScoringDecayParameters this_ptr_conv;
56583         this_ptr_conv.inner = untag_ptr(this_ptr);
56584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56586         this_ptr_conv.is_owned = false;
56587         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
56588         return ret_conv;
56589 }
56590
56591 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) {
56592         LDKProbabilisticScoringDecayParameters this_ptr_conv;
56593         this_ptr_conv.inner = untag_ptr(this_ptr);
56594         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56596         this_ptr_conv.is_owned = false;
56597         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
56598 }
56599
56600 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) {
56601         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
56602         uint64_t ret_ref = 0;
56603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56605         return ret_ref;
56606 }
56607
56608 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
56609         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
56610         uint64_t ret_ref = 0;
56611         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56612         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56613         return ret_ref;
56614 }
56615 int64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone_ptr"))) TS_ProbabilisticScoringDecayParameters_clone_ptr(uint64_t arg) {
56616         LDKProbabilisticScoringDecayParameters arg_conv;
56617         arg_conv.inner = untag_ptr(arg);
56618         arg_conv.is_owned = ptr_is_owned(arg);
56619         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56620         arg_conv.is_owned = false;
56621         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
56622         return ret_conv;
56623 }
56624
56625 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_clone"))) TS_ProbabilisticScoringDecayParameters_clone(uint64_t orig) {
56626         LDKProbabilisticScoringDecayParameters orig_conv;
56627         orig_conv.inner = untag_ptr(orig);
56628         orig_conv.is_owned = ptr_is_owned(orig);
56629         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56630         orig_conv.is_owned = false;
56631         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
56632         uint64_t ret_ref = 0;
56633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56635         return ret_ref;
56636 }
56637
56638 uint64_t  __attribute__((export_name("TS_ProbabilisticScoringDecayParameters_default"))) TS_ProbabilisticScoringDecayParameters_default() {
56639         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
56640         uint64_t ret_ref = 0;
56641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56643         return ret_ref;
56644 }
56645
56646 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t decay_params, uint64_t network_graph, uint64_t logger) {
56647         LDKProbabilisticScoringDecayParameters decay_params_conv;
56648         decay_params_conv.inner = untag_ptr(decay_params);
56649         decay_params_conv.is_owned = ptr_is_owned(decay_params);
56650         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
56651         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
56652         LDKNetworkGraph network_graph_conv;
56653         network_graph_conv.inner = untag_ptr(network_graph);
56654         network_graph_conv.is_owned = ptr_is_owned(network_graph);
56655         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
56656         network_graph_conv.is_owned = false;
56657         void* logger_ptr = untag_ptr(logger);
56658         CHECK_ACCESS(logger_ptr);
56659         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
56660         if (logger_conv.free == LDKLogger_JCalls_free) {
56661                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56662                 LDKLogger_JCalls_cloned(&logger_conv);
56663         }
56664         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
56665         uint64_t ret_ref = 0;
56666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56668         return ret_ref;
56669 }
56670
56671 void  __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
56672         LDKProbabilisticScorer this_arg_conv;
56673         this_arg_conv.inner = untag_ptr(this_arg);
56674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56676         this_arg_conv.is_owned = false;
56677         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
56678 }
56679
56680 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) {
56681         LDKProbabilisticScorer this_arg_conv;
56682         this_arg_conv.inner = untag_ptr(this_arg);
56683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56685         this_arg_conv.is_owned = false;
56686         LDKNodeId target_conv;
56687         target_conv.inner = untag_ptr(target);
56688         target_conv.is_owned = ptr_is_owned(target);
56689         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
56690         target_conv.is_owned = false;
56691         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
56692         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
56693         uint64_t ret_ref = tag_ptr(ret_copy, true);
56694         return ret_ref;
56695 }
56696
56697 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) {
56698         LDKProbabilisticScorer this_arg_conv;
56699         this_arg_conv.inner = untag_ptr(this_arg);
56700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56702         this_arg_conv.is_owned = false;
56703         LDKNodeId target_conv;
56704         target_conv.inner = untag_ptr(target);
56705         target_conv.is_owned = ptr_is_owned(target);
56706         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
56707         target_conv.is_owned = false;
56708         LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
56709         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
56710         uint64_t ret_ref = tag_ptr(ret_copy, true);
56711         return ret_ref;
56712 }
56713
56714 uint64_t  __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
56715         LDKProbabilisticScorer this_arg_conv;
56716         this_arg_conv.inner = untag_ptr(this_arg);
56717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
56718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
56719         this_arg_conv.is_owned = false;
56720         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
56721         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
56722         return tag_ptr(ret_ret, true);
56723 }
56724
56725 int8_tArray  __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
56726         LDKProbabilisticScorer obj_conv;
56727         obj_conv.inner = untag_ptr(obj);
56728         obj_conv.is_owned = ptr_is_owned(obj);
56729         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
56730         obj_conv.is_owned = false;
56731         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
56732         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
56733         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
56734         CVec_u8Z_free(ret_var);
56735         return ret_arr;
56736 }
56737
56738 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) {
56739         LDKu8slice ser_ref;
56740         ser_ref.datalen = ser->arr_len;
56741         ser_ref.data = ser->elems;
56742         LDKProbabilisticScoringDecayParameters arg_a_conv;
56743         arg_a_conv.inner = untag_ptr(arg_a);
56744         arg_a_conv.is_owned = ptr_is_owned(arg_a);
56745         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
56746         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
56747         LDKNetworkGraph arg_b_conv;
56748         arg_b_conv.inner = untag_ptr(arg_b);
56749         arg_b_conv.is_owned = ptr_is_owned(arg_b);
56750         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
56751         arg_b_conv.is_owned = false;
56752         void* arg_c_ptr = untag_ptr(arg_c);
56753         CHECK_ACCESS(arg_c_ptr);
56754         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
56755         if (arg_c_conv.free == LDKLogger_JCalls_free) {
56756                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
56757                 LDKLogger_JCalls_cloned(&arg_c_conv);
56758         }
56759         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
56760         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
56761         FREE(ser);
56762         return tag_ptr(ret_conv, true);
56763 }
56764
56765 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_free"))) TS_DelayedPaymentOutputDescriptor_free(uint64_t this_obj) {
56766         LDKDelayedPaymentOutputDescriptor this_obj_conv;
56767         this_obj_conv.inner = untag_ptr(this_obj);
56768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56770         DelayedPaymentOutputDescriptor_free(this_obj_conv);
56771 }
56772
56773 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_outpoint"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
56774         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56775         this_ptr_conv.inner = untag_ptr(this_ptr);
56776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56778         this_ptr_conv.is_owned = false;
56779         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
56780         uint64_t ret_ref = 0;
56781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56783         return ret_ref;
56784 }
56785
56786 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_outpoint"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
56787         LDKDelayedPaymentOutputDescriptor 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         LDKOutPoint val_conv;
56793         val_conv.inner = untag_ptr(val);
56794         val_conv.is_owned = ptr_is_owned(val);
56795         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56796         val_conv = OutPoint_clone(&val_conv);
56797         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
56798 }
56799
56800 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint64_t this_ptr) {
56801         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56802         this_ptr_conv.inner = untag_ptr(this_ptr);
56803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56805         this_ptr_conv.is_owned = false;
56806         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56807         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
56808         return ret_arr;
56809 }
56810
56811 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_per_commitment_point"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
56812         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56813         this_ptr_conv.inner = untag_ptr(this_ptr);
56814         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56816         this_ptr_conv.is_owned = false;
56817         LDKPublicKey val_ref;
56818         CHECK(val->arr_len == 33);
56819         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56820         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
56821 }
56822
56823 int16_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint64_t this_ptr) {
56824         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56825         this_ptr_conv.inner = untag_ptr(this_ptr);
56826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56828         this_ptr_conv.is_owned = false;
56829         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
56830         return ret_conv;
56831 }
56832
56833 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_to_self_delay"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint64_t this_ptr, int16_t val) {
56834         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56835         this_ptr_conv.inner = untag_ptr(this_ptr);
56836         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56838         this_ptr_conv.is_owned = false;
56839         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
56840 }
56841
56842 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_output"))) TS_DelayedPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
56843         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56844         this_ptr_conv.inner = untag_ptr(this_ptr);
56845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56847         this_ptr_conv.is_owned = false;
56848         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
56849         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
56850         return tag_ptr(ret_ref, true);
56851 }
56852
56853 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_output"))) TS_DelayedPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
56854         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56855         this_ptr_conv.inner = untag_ptr(this_ptr);
56856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56858         this_ptr_conv.is_owned = false;
56859         void* val_ptr = untag_ptr(val);
56860         CHECK_ACCESS(val_ptr);
56861         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
56862         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
56863         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
56864 }
56865
56866 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint64_t this_ptr) {
56867         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56868         this_ptr_conv.inner = untag_ptr(this_ptr);
56869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56871         this_ptr_conv.is_owned = false;
56872         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
56873         memcpy(ret_arr->elems, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33);
56874         return ret_arr;
56875 }
56876
56877 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint64_t this_ptr, int8_tArray val) {
56878         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56879         this_ptr_conv.inner = untag_ptr(this_ptr);
56880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56882         this_ptr_conv.is_owned = false;
56883         LDKPublicKey val_ref;
56884         CHECK(val->arr_len == 33);
56885         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
56886         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
56887 }
56888
56889 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
56890         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56891         this_ptr_conv.inner = untag_ptr(this_ptr);
56892         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56894         this_ptr_conv.is_owned = false;
56895         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
56896         memcpy(ret_arr->elems, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
56897         return ret_arr;
56898 }
56899
56900 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_keys_id"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
56901         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56902         this_ptr_conv.inner = untag_ptr(this_ptr);
56903         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56904         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56905         this_ptr_conv.is_owned = false;
56906         LDKThirtyTwoBytes val_ref;
56907         CHECK(val->arr_len == 32);
56908         memcpy(val_ref.data, val->elems, 32); FREE(val);
56909         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
56910 }
56911
56912 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
56913         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56914         this_ptr_conv.inner = untag_ptr(this_ptr);
56915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56917         this_ptr_conv.is_owned = false;
56918         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
56919         return ret_conv;
56920 }
56921
56922 void  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
56923         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
56924         this_ptr_conv.inner = untag_ptr(this_ptr);
56925         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56926         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56927         this_ptr_conv.is_owned = false;
56928         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
56929 }
56930
56931 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) {
56932         LDKOutPoint outpoint_arg_conv;
56933         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
56934         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
56935         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
56936         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
56937         LDKPublicKey per_commitment_point_arg_ref;
56938         CHECK(per_commitment_point_arg->arr_len == 33);
56939         memcpy(per_commitment_point_arg_ref.compressed_form, per_commitment_point_arg->elems, 33); FREE(per_commitment_point_arg);
56940         void* output_arg_ptr = untag_ptr(output_arg);
56941         CHECK_ACCESS(output_arg_ptr);
56942         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
56943         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
56944         LDKPublicKey revocation_pubkey_arg_ref;
56945         CHECK(revocation_pubkey_arg->arr_len == 33);
56946         memcpy(revocation_pubkey_arg_ref.compressed_form, revocation_pubkey_arg->elems, 33); FREE(revocation_pubkey_arg);
56947         LDKThirtyTwoBytes channel_keys_id_arg_ref;
56948         CHECK(channel_keys_id_arg->arr_len == 32);
56949         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
56950         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);
56951         uint64_t ret_ref = 0;
56952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56954         return ret_ref;
56955 }
56956
56957 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
56958         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
56959         uint64_t ret_ref = 0;
56960         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56961         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56962         return ret_ref;
56963 }
56964 int64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone_ptr"))) TS_DelayedPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
56965         LDKDelayedPaymentOutputDescriptor arg_conv;
56966         arg_conv.inner = untag_ptr(arg);
56967         arg_conv.is_owned = ptr_is_owned(arg);
56968         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56969         arg_conv.is_owned = false;
56970         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
56971         return ret_conv;
56972 }
56973
56974 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_clone"))) TS_DelayedPaymentOutputDescriptor_clone(uint64_t orig) {
56975         LDKDelayedPaymentOutputDescriptor orig_conv;
56976         orig_conv.inner = untag_ptr(orig);
56977         orig_conv.is_owned = ptr_is_owned(orig);
56978         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56979         orig_conv.is_owned = false;
56980         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
56981         uint64_t ret_ref = 0;
56982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56984         return ret_ref;
56985 }
56986
56987 jboolean  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_eq"))) TS_DelayedPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
56988         LDKDelayedPaymentOutputDescriptor a_conv;
56989         a_conv.inner = untag_ptr(a);
56990         a_conv.is_owned = ptr_is_owned(a);
56991         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56992         a_conv.is_owned = false;
56993         LDKDelayedPaymentOutputDescriptor b_conv;
56994         b_conv.inner = untag_ptr(b);
56995         b_conv.is_owned = ptr_is_owned(b);
56996         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56997         b_conv.is_owned = false;
56998         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
56999         return ret_conv;
57000 }
57001
57002 int8_tArray  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_write"))) TS_DelayedPaymentOutputDescriptor_write(uint64_t obj) {
57003         LDKDelayedPaymentOutputDescriptor obj_conv;
57004         obj_conv.inner = untag_ptr(obj);
57005         obj_conv.is_owned = ptr_is_owned(obj);
57006         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57007         obj_conv.is_owned = false;
57008         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
57009         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57010         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57011         CVec_u8Z_free(ret_var);
57012         return ret_arr;
57013 }
57014
57015 uint64_t  __attribute__((export_name("TS_DelayedPaymentOutputDescriptor_read"))) TS_DelayedPaymentOutputDescriptor_read(int8_tArray ser) {
57016         LDKu8slice ser_ref;
57017         ser_ref.datalen = ser->arr_len;
57018         ser_ref.data = ser->elems;
57019         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
57020         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
57021         FREE(ser);
57022         return tag_ptr(ret_conv, true);
57023 }
57024
57025 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_free"))) TS_StaticPaymentOutputDescriptor_free(uint64_t this_obj) {
57026         LDKStaticPaymentOutputDescriptor this_obj_conv;
57027         this_obj_conv.inner = untag_ptr(this_obj);
57028         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57030         StaticPaymentOutputDescriptor_free(this_obj_conv);
57031 }
57032
57033 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_outpoint"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint64_t this_ptr) {
57034         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57035         this_ptr_conv.inner = untag_ptr(this_ptr);
57036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57038         this_ptr_conv.is_owned = false;
57039         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
57040         uint64_t ret_ref = 0;
57041         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57042         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57043         return ret_ref;
57044 }
57045
57046 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_outpoint"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
57047         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57048         this_ptr_conv.inner = untag_ptr(this_ptr);
57049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57051         this_ptr_conv.is_owned = false;
57052         LDKOutPoint val_conv;
57053         val_conv.inner = untag_ptr(val);
57054         val_conv.is_owned = ptr_is_owned(val);
57055         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57056         val_conv = OutPoint_clone(&val_conv);
57057         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
57058 }
57059
57060 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_output"))) TS_StaticPaymentOutputDescriptor_get_output(uint64_t this_ptr) {
57061         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57062         this_ptr_conv.inner = untag_ptr(this_ptr);
57063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57065         this_ptr_conv.is_owned = false;
57066         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
57067         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
57068         return tag_ptr(ret_ref, true);
57069 }
57070
57071 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_output"))) TS_StaticPaymentOutputDescriptor_set_output(uint64_t this_ptr, uint64_t val) {
57072         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57073         this_ptr_conv.inner = untag_ptr(this_ptr);
57074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57076         this_ptr_conv.is_owned = false;
57077         void* val_ptr = untag_ptr(val);
57078         CHECK_ACCESS(val_ptr);
57079         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
57080         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
57081         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
57082 }
57083
57084 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint64_t this_ptr) {
57085         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57086         this_ptr_conv.inner = untag_ptr(this_ptr);
57087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57089         this_ptr_conv.is_owned = false;
57090         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57091         memcpy(ret_arr->elems, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32);
57092         return ret_arr;
57093 }
57094
57095 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_keys_id"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint64_t this_ptr, int8_tArray val) {
57096         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57097         this_ptr_conv.inner = untag_ptr(this_ptr);
57098         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57100         this_ptr_conv.is_owned = false;
57101         LDKThirtyTwoBytes val_ref;
57102         CHECK(val->arr_len == 32);
57103         memcpy(val_ref.data, val->elems, 32); FREE(val);
57104         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
57105 }
57106
57107 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint64_t this_ptr) {
57108         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57109         this_ptr_conv.inner = untag_ptr(this_ptr);
57110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57112         this_ptr_conv.is_owned = false;
57113         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
57114         return ret_conv;
57115 }
57116
57117 void  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint64_t this_ptr, int64_t val) {
57118         LDKStaticPaymentOutputDescriptor this_ptr_conv;
57119         this_ptr_conv.inner = untag_ptr(this_ptr);
57120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57122         this_ptr_conv.is_owned = false;
57123         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
57124 }
57125
57126 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) {
57127         LDKOutPoint outpoint_arg_conv;
57128         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
57129         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
57130         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
57131         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
57132         void* output_arg_ptr = untag_ptr(output_arg);
57133         CHECK_ACCESS(output_arg_ptr);
57134         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
57135         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
57136         LDKThirtyTwoBytes channel_keys_id_arg_ref;
57137         CHECK(channel_keys_id_arg->arr_len == 32);
57138         memcpy(channel_keys_id_arg_ref.data, channel_keys_id_arg->elems, 32); FREE(channel_keys_id_arg);
57139         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
57140         uint64_t ret_ref = 0;
57141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57143         return ret_ref;
57144 }
57145
57146 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
57147         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
57148         uint64_t ret_ref = 0;
57149         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57150         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57151         return ret_ref;
57152 }
57153 int64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone_ptr"))) TS_StaticPaymentOutputDescriptor_clone_ptr(uint64_t arg) {
57154         LDKStaticPaymentOutputDescriptor arg_conv;
57155         arg_conv.inner = untag_ptr(arg);
57156         arg_conv.is_owned = ptr_is_owned(arg);
57157         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57158         arg_conv.is_owned = false;
57159         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
57160         return ret_conv;
57161 }
57162
57163 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_clone"))) TS_StaticPaymentOutputDescriptor_clone(uint64_t orig) {
57164         LDKStaticPaymentOutputDescriptor orig_conv;
57165         orig_conv.inner = untag_ptr(orig);
57166         orig_conv.is_owned = ptr_is_owned(orig);
57167         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57168         orig_conv.is_owned = false;
57169         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
57170         uint64_t ret_ref = 0;
57171         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57172         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57173         return ret_ref;
57174 }
57175
57176 jboolean  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_eq"))) TS_StaticPaymentOutputDescriptor_eq(uint64_t a, uint64_t b) {
57177         LDKStaticPaymentOutputDescriptor a_conv;
57178         a_conv.inner = untag_ptr(a);
57179         a_conv.is_owned = ptr_is_owned(a);
57180         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57181         a_conv.is_owned = false;
57182         LDKStaticPaymentOutputDescriptor b_conv;
57183         b_conv.inner = untag_ptr(b);
57184         b_conv.is_owned = ptr_is_owned(b);
57185         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57186         b_conv.is_owned = false;
57187         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
57188         return ret_conv;
57189 }
57190
57191 int8_tArray  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_write"))) TS_StaticPaymentOutputDescriptor_write(uint64_t obj) {
57192         LDKStaticPaymentOutputDescriptor obj_conv;
57193         obj_conv.inner = untag_ptr(obj);
57194         obj_conv.is_owned = ptr_is_owned(obj);
57195         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57196         obj_conv.is_owned = false;
57197         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
57198         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57199         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57200         CVec_u8Z_free(ret_var);
57201         return ret_arr;
57202 }
57203
57204 uint64_t  __attribute__((export_name("TS_StaticPaymentOutputDescriptor_read"))) TS_StaticPaymentOutputDescriptor_read(int8_tArray ser) {
57205         LDKu8slice ser_ref;
57206         ser_ref.datalen = ser->arr_len;
57207         ser_ref.data = ser->elems;
57208         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
57209         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
57210         FREE(ser);
57211         return tag_ptr(ret_conv, true);
57212 }
57213
57214 void  __attribute__((export_name("TS_SpendableOutputDescriptor_free"))) TS_SpendableOutputDescriptor_free(uint64_t this_ptr) {
57215         if (!ptr_is_owned(this_ptr)) return;
57216         void* this_ptr_ptr = untag_ptr(this_ptr);
57217         CHECK_ACCESS(this_ptr_ptr);
57218         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
57219         FREE(untag_ptr(this_ptr));
57220         SpendableOutputDescriptor_free(this_ptr_conv);
57221 }
57222
57223 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
57224         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57225         *ret_copy = SpendableOutputDescriptor_clone(arg);
57226         uint64_t ret_ref = tag_ptr(ret_copy, true);
57227         return ret_ref;
57228 }
57229 int64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone_ptr"))) TS_SpendableOutputDescriptor_clone_ptr(uint64_t arg) {
57230         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
57231         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
57232         return ret_conv;
57233 }
57234
57235 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_clone"))) TS_SpendableOutputDescriptor_clone(uint64_t orig) {
57236         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
57237         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57238         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
57239         uint64_t ret_ref = tag_ptr(ret_copy, true);
57240         return ret_ref;
57241 }
57242
57243 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_output"))) TS_SpendableOutputDescriptor_static_output(uint64_t outpoint, uint64_t output) {
57244         LDKOutPoint outpoint_conv;
57245         outpoint_conv.inner = untag_ptr(outpoint);
57246         outpoint_conv.is_owned = ptr_is_owned(outpoint);
57247         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
57248         outpoint_conv = OutPoint_clone(&outpoint_conv);
57249         void* output_ptr = untag_ptr(output);
57250         CHECK_ACCESS(output_ptr);
57251         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
57252         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
57253         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57254         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
57255         uint64_t ret_ref = tag_ptr(ret_copy, true);
57256         return ret_ref;
57257 }
57258
57259 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_delayed_payment_output"))) TS_SpendableOutputDescriptor_delayed_payment_output(uint64_t a) {
57260         LDKDelayedPaymentOutputDescriptor a_conv;
57261         a_conv.inner = untag_ptr(a);
57262         a_conv.is_owned = ptr_is_owned(a);
57263         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57264         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
57265         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57266         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
57267         uint64_t ret_ref = tag_ptr(ret_copy, true);
57268         return ret_ref;
57269 }
57270
57271 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_static_payment_output"))) TS_SpendableOutputDescriptor_static_payment_output(uint64_t a) {
57272         LDKStaticPaymentOutputDescriptor a_conv;
57273         a_conv.inner = untag_ptr(a);
57274         a_conv.is_owned = ptr_is_owned(a);
57275         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57276         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
57277         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
57278         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
57279         uint64_t ret_ref = tag_ptr(ret_copy, true);
57280         return ret_ref;
57281 }
57282
57283 jboolean  __attribute__((export_name("TS_SpendableOutputDescriptor_eq"))) TS_SpendableOutputDescriptor_eq(uint64_t a, uint64_t b) {
57284         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
57285         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
57286         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
57287         return ret_conv;
57288 }
57289
57290 int8_tArray  __attribute__((export_name("TS_SpendableOutputDescriptor_write"))) TS_SpendableOutputDescriptor_write(uint64_t obj) {
57291         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
57292         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
57293         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57294         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57295         CVec_u8Z_free(ret_var);
57296         return ret_arr;
57297 }
57298
57299 uint64_t  __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_SpendableOutputDescriptor_read(int8_tArray ser) {
57300         LDKu8slice ser_ref;
57301         ser_ref.datalen = ser->arr_len;
57302         ser_ref.data = ser->elems;
57303         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
57304         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
57305         FREE(ser);
57306         return tag_ptr(ret_conv, true);
57307 }
57308
57309 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) {
57310         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
57311         descriptors_constr.datalen = descriptors->arr_len;
57312         if (descriptors_constr.datalen > 0)
57313                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
57314         else
57315                 descriptors_constr.data = NULL;
57316         uint64_t* descriptors_vals = descriptors->elems;
57317         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
57318                 uint64_t descriptors_conv_27 = descriptors_vals[b];
57319                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
57320                 CHECK_ACCESS(descriptors_conv_27_ptr);
57321                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
57322                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
57323                 descriptors_constr.data[b] = descriptors_conv_27_conv;
57324         }
57325         FREE(descriptors);
57326         LDKCVec_TxOutZ outputs_constr;
57327         outputs_constr.datalen = outputs->arr_len;
57328         if (outputs_constr.datalen > 0)
57329                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
57330         else
57331                 outputs_constr.data = NULL;
57332         uint64_t* outputs_vals = outputs->elems;
57333         for (size_t h = 0; h < outputs_constr.datalen; h++) {
57334                 uint64_t outputs_conv_7 = outputs_vals[h];
57335                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
57336                 CHECK_ACCESS(outputs_conv_7_ptr);
57337                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
57338                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
57339                 outputs_constr.data[h] = outputs_conv_7_conv;
57340         }
57341         FREE(outputs);
57342         LDKCVec_u8Z change_destination_script_ref;
57343         change_destination_script_ref.datalen = change_destination_script->arr_len;
57344         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
57345         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
57346         void* locktime_ptr = untag_ptr(locktime);
57347         CHECK_ACCESS(locktime_ptr);
57348         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
57349         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
57350         LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ), "LDKCResult_C2Tuple_PartiallySignedTransactionusizeZNoneZ");
57351         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
57352         return tag_ptr(ret_conv, true);
57353 }
57354
57355 void  __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_free(uint64_t this_ptr) {
57356         if (!ptr_is_owned(this_ptr)) return;
57357         void* this_ptr_ptr = untag_ptr(this_ptr);
57358         CHECK_ACCESS(this_ptr_ptr);
57359         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
57360         FREE(untag_ptr(this_ptr));
57361         ChannelSigner_free(this_ptr_conv);
57362 }
57363
57364 void  __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_free(uint64_t this_ptr) {
57365         if (!ptr_is_owned(this_ptr)) return;
57366         void* this_ptr_ptr = untag_ptr(this_ptr);
57367         CHECK_ACCESS(this_ptr_ptr);
57368         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
57369         FREE(untag_ptr(this_ptr));
57370         EcdsaChannelSigner_free(this_ptr_conv);
57371 }
57372
57373 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
57374         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
57375         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
57376         return tag_ptr(ret_ret, true);
57377 }
57378 int64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) {
57379         void* arg_ptr = untag_ptr(arg);
57380         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
57381         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
57382         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
57383         return ret_conv;
57384 }
57385
57386 uint64_t  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) {
57387         void* orig_ptr = untag_ptr(orig);
57388         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
57389         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
57390         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
57391         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
57392         return tag_ptr(ret_ret, true);
57393 }
57394
57395 void  __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_free(uint64_t this_ptr) {
57396         if (!ptr_is_owned(this_ptr)) return;
57397         void* this_ptr_ptr = untag_ptr(this_ptr);
57398         CHECK_ACCESS(this_ptr_ptr);
57399         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
57400         FREE(untag_ptr(this_ptr));
57401         WriteableEcdsaChannelSigner_free(this_ptr_conv);
57402 }
57403
57404 uint32_t  __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) {
57405         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
57406         uint32_t ret_conv = LDKRecipient_to_js(Recipient_clone(orig_conv));
57407         return ret_conv;
57408 }
57409
57410 uint32_t  __attribute__((export_name("TS_Recipient_node"))) TS_Recipient_node() {
57411         uint32_t ret_conv = LDKRecipient_to_js(Recipient_node());
57412         return ret_conv;
57413 }
57414
57415 uint32_t  __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient_phantom_node() {
57416         uint32_t ret_conv = LDKRecipient_to_js(Recipient_phantom_node());
57417         return ret_conv;
57418 }
57419
57420 void  __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_free(uint64_t this_ptr) {
57421         if (!ptr_is_owned(this_ptr)) return;
57422         void* this_ptr_ptr = untag_ptr(this_ptr);
57423         CHECK_ACCESS(this_ptr_ptr);
57424         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
57425         FREE(untag_ptr(this_ptr));
57426         EntropySource_free(this_ptr_conv);
57427 }
57428
57429 void  __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_free(uint64_t this_ptr) {
57430         if (!ptr_is_owned(this_ptr)) return;
57431         void* this_ptr_ptr = untag_ptr(this_ptr);
57432         CHECK_ACCESS(this_ptr_ptr);
57433         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
57434         FREE(untag_ptr(this_ptr));
57435         NodeSigner_free(this_ptr_conv);
57436 }
57437
57438 void  __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_free(uint64_t this_ptr) {
57439         if (!ptr_is_owned(this_ptr)) return;
57440         void* this_ptr_ptr = untag_ptr(this_ptr);
57441         CHECK_ACCESS(this_ptr_ptr);
57442         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
57443         FREE(untag_ptr(this_ptr));
57444         SignerProvider_free(this_ptr_conv);
57445 }
57446
57447 void  __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) {
57448         LDKInMemorySigner this_obj_conv;
57449         this_obj_conv.inner = untag_ptr(this_obj);
57450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57452         InMemorySigner_free(this_obj_conv);
57453 }
57454
57455 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_funding_key"))) TS_InMemorySigner_get_funding_key(uint64_t this_ptr) {
57456         LDKInMemorySigner this_ptr_conv;
57457         this_ptr_conv.inner = untag_ptr(this_ptr);
57458         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57460         this_ptr_conv.is_owned = false;
57461         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57462         memcpy(ret_arr->elems, *InMemorySigner_get_funding_key(&this_ptr_conv), 32);
57463         return ret_arr;
57464 }
57465
57466 void  __attribute__((export_name("TS_InMemorySigner_set_funding_key"))) TS_InMemorySigner_set_funding_key(uint64_t this_ptr, int8_tArray val) {
57467         LDKInMemorySigner this_ptr_conv;
57468         this_ptr_conv.inner = untag_ptr(this_ptr);
57469         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57470         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57471         this_ptr_conv.is_owned = false;
57472         LDKSecretKey val_ref;
57473         CHECK(val->arr_len == 32);
57474         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57475         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
57476 }
57477
57478 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_revocation_base_key"))) TS_InMemorySigner_get_revocation_base_key(uint64_t this_ptr) {
57479         LDKInMemorySigner this_ptr_conv;
57480         this_ptr_conv.inner = untag_ptr(this_ptr);
57481         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57483         this_ptr_conv.is_owned = false;
57484         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57485         memcpy(ret_arr->elems, *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32);
57486         return ret_arr;
57487 }
57488
57489 void  __attribute__((export_name("TS_InMemorySigner_set_revocation_base_key"))) TS_InMemorySigner_set_revocation_base_key(uint64_t this_ptr, int8_tArray val) {
57490         LDKInMemorySigner this_ptr_conv;
57491         this_ptr_conv.inner = untag_ptr(this_ptr);
57492         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57494         this_ptr_conv.is_owned = false;
57495         LDKSecretKey val_ref;
57496         CHECK(val->arr_len == 32);
57497         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57498         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
57499 }
57500
57501 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_payment_key"))) TS_InMemorySigner_get_payment_key(uint64_t this_ptr) {
57502         LDKInMemorySigner this_ptr_conv;
57503         this_ptr_conv.inner = untag_ptr(this_ptr);
57504         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57506         this_ptr_conv.is_owned = false;
57507         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57508         memcpy(ret_arr->elems, *InMemorySigner_get_payment_key(&this_ptr_conv), 32);
57509         return ret_arr;
57510 }
57511
57512 void  __attribute__((export_name("TS_InMemorySigner_set_payment_key"))) TS_InMemorySigner_set_payment_key(uint64_t this_ptr, int8_tArray val) {
57513         LDKInMemorySigner this_ptr_conv;
57514         this_ptr_conv.inner = untag_ptr(this_ptr);
57515         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57516         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57517         this_ptr_conv.is_owned = false;
57518         LDKSecretKey val_ref;
57519         CHECK(val->arr_len == 32);
57520         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57521         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
57522 }
57523
57524 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_delayed_payment_base_key"))) TS_InMemorySigner_get_delayed_payment_base_key(uint64_t this_ptr) {
57525         LDKInMemorySigner this_ptr_conv;
57526         this_ptr_conv.inner = untag_ptr(this_ptr);
57527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57529         this_ptr_conv.is_owned = false;
57530         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57531         memcpy(ret_arr->elems, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32);
57532         return ret_arr;
57533 }
57534
57535 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) {
57536         LDKInMemorySigner this_ptr_conv;
57537         this_ptr_conv.inner = untag_ptr(this_ptr);
57538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57540         this_ptr_conv.is_owned = false;
57541         LDKSecretKey val_ref;
57542         CHECK(val->arr_len == 32);
57543         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57544         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
57545 }
57546
57547 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_htlc_base_key"))) TS_InMemorySigner_get_htlc_base_key(uint64_t this_ptr) {
57548         LDKInMemorySigner this_ptr_conv;
57549         this_ptr_conv.inner = untag_ptr(this_ptr);
57550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57552         this_ptr_conv.is_owned = false;
57553         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57554         memcpy(ret_arr->elems, *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32);
57555         return ret_arr;
57556 }
57557
57558 void  __attribute__((export_name("TS_InMemorySigner_set_htlc_base_key"))) TS_InMemorySigner_set_htlc_base_key(uint64_t this_ptr, int8_tArray val) {
57559         LDKInMemorySigner this_ptr_conv;
57560         this_ptr_conv.inner = untag_ptr(this_ptr);
57561         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57563         this_ptr_conv.is_owned = false;
57564         LDKSecretKey val_ref;
57565         CHECK(val->arr_len == 32);
57566         memcpy(val_ref.bytes, val->elems, 32); FREE(val);
57567         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
57568 }
57569
57570 int8_tArray  __attribute__((export_name("TS_InMemorySigner_get_commitment_seed"))) TS_InMemorySigner_get_commitment_seed(uint64_t this_ptr) {
57571         LDKInMemorySigner this_ptr_conv;
57572         this_ptr_conv.inner = untag_ptr(this_ptr);
57573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57575         this_ptr_conv.is_owned = false;
57576         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57577         memcpy(ret_arr->elems, *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32);
57578         return ret_arr;
57579 }
57580
57581 void  __attribute__((export_name("TS_InMemorySigner_set_commitment_seed"))) TS_InMemorySigner_set_commitment_seed(uint64_t this_ptr, int8_tArray val) {
57582         LDKInMemorySigner this_ptr_conv;
57583         this_ptr_conv.inner = untag_ptr(this_ptr);
57584         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57586         this_ptr_conv.is_owned = false;
57587         LDKThirtyTwoBytes val_ref;
57588         CHECK(val->arr_len == 32);
57589         memcpy(val_ref.data, val->elems, 32); FREE(val);
57590         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
57591 }
57592
57593 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
57594         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
57595         uint64_t ret_ref = 0;
57596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57598         return ret_ref;
57599 }
57600 int64_t  __attribute__((export_name("TS_InMemorySigner_clone_ptr"))) TS_InMemorySigner_clone_ptr(uint64_t arg) {
57601         LDKInMemorySigner arg_conv;
57602         arg_conv.inner = untag_ptr(arg);
57603         arg_conv.is_owned = ptr_is_owned(arg);
57604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57605         arg_conv.is_owned = false;
57606         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
57607         return ret_conv;
57608 }
57609
57610 uint64_t  __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySigner_clone(uint64_t orig) {
57611         LDKInMemorySigner orig_conv;
57612         orig_conv.inner = untag_ptr(orig);
57613         orig_conv.is_owned = ptr_is_owned(orig);
57614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57615         orig_conv.is_owned = false;
57616         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
57617         uint64_t ret_ref = 0;
57618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57620         return ret_ref;
57621 }
57622
57623 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) {
57624         LDKSecretKey funding_key_ref;
57625         CHECK(funding_key->arr_len == 32);
57626         memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key);
57627         LDKSecretKey revocation_base_key_ref;
57628         CHECK(revocation_base_key->arr_len == 32);
57629         memcpy(revocation_base_key_ref.bytes, revocation_base_key->elems, 32); FREE(revocation_base_key);
57630         LDKSecretKey payment_key_ref;
57631         CHECK(payment_key->arr_len == 32);
57632         memcpy(payment_key_ref.bytes, payment_key->elems, 32); FREE(payment_key);
57633         LDKSecretKey delayed_payment_base_key_ref;
57634         CHECK(delayed_payment_base_key->arr_len == 32);
57635         memcpy(delayed_payment_base_key_ref.bytes, delayed_payment_base_key->elems, 32); FREE(delayed_payment_base_key);
57636         LDKSecretKey htlc_base_key_ref;
57637         CHECK(htlc_base_key->arr_len == 32);
57638         memcpy(htlc_base_key_ref.bytes, htlc_base_key->elems, 32); FREE(htlc_base_key);
57639         LDKThirtyTwoBytes commitment_seed_ref;
57640         CHECK(commitment_seed->arr_len == 32);
57641         memcpy(commitment_seed_ref.data, commitment_seed->elems, 32); FREE(commitment_seed);
57642         LDKThirtyTwoBytes channel_keys_id_ref;
57643         CHECK(channel_keys_id->arr_len == 32);
57644         memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id);
57645         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
57646         CHECK(rand_bytes_unique_start->arr_len == 32);
57647         memcpy(rand_bytes_unique_start_ref.data, rand_bytes_unique_start->elems, 32); FREE(rand_bytes_unique_start);
57648         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);
57649         uint64_t ret_ref = 0;
57650         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57651         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57652         return ret_ref;
57653 }
57654
57655 uint64_t  __attribute__((export_name("TS_InMemorySigner_counterparty_pubkeys"))) TS_InMemorySigner_counterparty_pubkeys(uint64_t this_arg) {
57656         LDKInMemorySigner this_arg_conv;
57657         this_arg_conv.inner = untag_ptr(this_arg);
57658         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57660         this_arg_conv.is_owned = false;
57661         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
57662         uint64_t ret_ref = 0;
57663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57665         return ret_ref;
57666 }
57667
57668 int16_t  __attribute__((export_name("TS_InMemorySigner_counterparty_selected_contest_delay"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint64_t this_arg) {
57669         LDKInMemorySigner this_arg_conv;
57670         this_arg_conv.inner = untag_ptr(this_arg);
57671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57673         this_arg_conv.is_owned = false;
57674         int16_t ret_conv = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
57675         return ret_conv;
57676 }
57677
57678 int16_t  __attribute__((export_name("TS_InMemorySigner_holder_selected_contest_delay"))) TS_InMemorySigner_holder_selected_contest_delay(uint64_t this_arg) {
57679         LDKInMemorySigner this_arg_conv;
57680         this_arg_conv.inner = untag_ptr(this_arg);
57681         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57683         this_arg_conv.is_owned = false;
57684         int16_t ret_conv = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
57685         return ret_conv;
57686 }
57687
57688 jboolean  __attribute__((export_name("TS_InMemorySigner_is_outbound"))) TS_InMemorySigner_is_outbound(uint64_t this_arg) {
57689         LDKInMemorySigner this_arg_conv;
57690         this_arg_conv.inner = untag_ptr(this_arg);
57691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57693         this_arg_conv.is_owned = false;
57694         jboolean ret_conv = InMemorySigner_is_outbound(&this_arg_conv);
57695         return ret_conv;
57696 }
57697
57698 uint64_t  __attribute__((export_name("TS_InMemorySigner_funding_outpoint"))) TS_InMemorySigner_funding_outpoint(uint64_t this_arg) {
57699         LDKInMemorySigner this_arg_conv;
57700         this_arg_conv.inner = untag_ptr(this_arg);
57701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57703         this_arg_conv.is_owned = false;
57704         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
57705         uint64_t ret_ref = 0;
57706         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57707         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57708         return ret_ref;
57709 }
57710
57711 uint64_t  __attribute__((export_name("TS_InMemorySigner_get_channel_parameters"))) TS_InMemorySigner_get_channel_parameters(uint64_t this_arg) {
57712         LDKInMemorySigner this_arg_conv;
57713         this_arg_conv.inner = untag_ptr(this_arg);
57714         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57716         this_arg_conv.is_owned = false;
57717         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
57718         uint64_t ret_ref = 0;
57719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57721         return ret_ref;
57722 }
57723
57724 uint64_t  __attribute__((export_name("TS_InMemorySigner_channel_type_features"))) TS_InMemorySigner_channel_type_features(uint64_t this_arg) {
57725         LDKInMemorySigner this_arg_conv;
57726         this_arg_conv.inner = untag_ptr(this_arg);
57727         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57729         this_arg_conv.is_owned = false;
57730         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
57731         uint64_t ret_ref = 0;
57732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57734         return ret_ref;
57735 }
57736
57737 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) {
57738         LDKInMemorySigner this_arg_conv;
57739         this_arg_conv.inner = untag_ptr(this_arg);
57740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57742         this_arg_conv.is_owned = false;
57743         LDKTransaction spend_tx_ref;
57744         spend_tx_ref.datalen = spend_tx->arr_len;
57745         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
57746         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
57747         spend_tx_ref.data_is_owned = true;
57748         LDKStaticPaymentOutputDescriptor descriptor_conv;
57749         descriptor_conv.inner = untag_ptr(descriptor);
57750         descriptor_conv.is_owned = ptr_is_owned(descriptor);
57751         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
57752         descriptor_conv.is_owned = false;
57753         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
57754         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
57755         return tag_ptr(ret_conv, true);
57756 }
57757
57758 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) {
57759         LDKInMemorySigner this_arg_conv;
57760         this_arg_conv.inner = untag_ptr(this_arg);
57761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57763         this_arg_conv.is_owned = false;
57764         LDKTransaction spend_tx_ref;
57765         spend_tx_ref.datalen = spend_tx->arr_len;
57766         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
57767         memcpy(spend_tx_ref.data, spend_tx->elems, spend_tx_ref.datalen); FREE(spend_tx);
57768         spend_tx_ref.data_is_owned = true;
57769         LDKDelayedPaymentOutputDescriptor descriptor_conv;
57770         descriptor_conv.inner = untag_ptr(descriptor);
57771         descriptor_conv.is_owned = ptr_is_owned(descriptor);
57772         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
57773         descriptor_conv.is_owned = false;
57774         LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
57775         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
57776         return tag_ptr(ret_conv, true);
57777 }
57778
57779 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EntropySource"))) TS_InMemorySigner_as_EntropySource(uint64_t this_arg) {
57780         LDKInMemorySigner this_arg_conv;
57781         this_arg_conv.inner = untag_ptr(this_arg);
57782         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57783         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57784         this_arg_conv.is_owned = false;
57785         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
57786         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
57787         return tag_ptr(ret_ret, true);
57788 }
57789
57790 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) {
57791         LDKInMemorySigner this_arg_conv;
57792         this_arg_conv.inner = untag_ptr(this_arg);
57793         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57795         this_arg_conv.is_owned = false;
57796         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
57797         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
57798         return tag_ptr(ret_ret, true);
57799 }
57800
57801 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) {
57802         LDKInMemorySigner this_arg_conv;
57803         this_arg_conv.inner = untag_ptr(this_arg);
57804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57806         this_arg_conv.is_owned = false;
57807         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
57808         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
57809         return tag_ptr(ret_ret, true);
57810 }
57811
57812 uint64_t  __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) {
57813         LDKInMemorySigner 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         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
57819         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
57820         return tag_ptr(ret_ret, true);
57821 }
57822
57823 int8_tArray  __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemorySigner_write(uint64_t obj) {
57824         LDKInMemorySigner obj_conv;
57825         obj_conv.inner = untag_ptr(obj);
57826         obj_conv.is_owned = ptr_is_owned(obj);
57827         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
57828         obj_conv.is_owned = false;
57829         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
57830         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
57831         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
57832         CVec_u8Z_free(ret_var);
57833         return ret_arr;
57834 }
57835
57836 uint64_t  __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, uint64_t arg) {
57837         LDKu8slice ser_ref;
57838         ser_ref.datalen = ser->arr_len;
57839         ser_ref.data = ser->elems;
57840         void* arg_ptr = untag_ptr(arg);
57841         CHECK_ACCESS(arg_ptr);
57842         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
57843         if (arg_conv.free == LDKEntropySource_JCalls_free) {
57844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
57845                 LDKEntropySource_JCalls_cloned(&arg_conv);
57846         }
57847         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
57848         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
57849         FREE(ser);
57850         return tag_ptr(ret_conv, true);
57851 }
57852
57853 void  __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(uint64_t this_obj) {
57854         LDKKeysManager this_obj_conv;
57855         this_obj_conv.inner = untag_ptr(this_obj);
57856         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57858         KeysManager_free(this_obj_conv);
57859 }
57860
57861 uint64_t  __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
57862         uint8_t seed_arr[32];
57863         CHECK(seed->arr_len == 32);
57864         memcpy(seed_arr, seed->elems, 32); FREE(seed);
57865         uint8_t (*seed_ref)[32] = &seed_arr;
57866         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
57867         uint64_t ret_ref = 0;
57868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57870         return ret_ref;
57871 }
57872
57873 int8_tArray  __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) {
57874         LDKKeysManager this_arg_conv;
57875         this_arg_conv.inner = untag_ptr(this_arg);
57876         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57877         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57878         this_arg_conv.is_owned = false;
57879         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
57880         memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
57881         return ret_arr;
57882 }
57883
57884 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) {
57885         LDKKeysManager this_arg_conv;
57886         this_arg_conv.inner = untag_ptr(this_arg);
57887         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57888         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57889         this_arg_conv.is_owned = false;
57890         uint8_t params_arr[32];
57891         CHECK(params->arr_len == 32);
57892         memcpy(params_arr, params->elems, 32); FREE(params);
57893         uint8_t (*params_ref)[32] = &params_arr;
57894         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
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 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) {
57902         LDKKeysManager this_arg_conv;
57903         this_arg_conv.inner = untag_ptr(this_arg);
57904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57906         this_arg_conv.is_owned = false;
57907         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
57908         descriptors_constr.datalen = descriptors->arr_len;
57909         if (descriptors_constr.datalen > 0)
57910                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
57911         else
57912                 descriptors_constr.data = NULL;
57913         uint64_t* descriptors_vals = descriptors->elems;
57914         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
57915                 uint64_t descriptors_conv_27 = descriptors_vals[b];
57916                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
57917                 CHECK_ACCESS(descriptors_conv_27_ptr);
57918                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
57919                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
57920                 descriptors_constr.data[b] = descriptors_conv_27_conv;
57921         }
57922         FREE(descriptors);
57923         LDKCVec_u8Z psbt_ref;
57924         psbt_ref.datalen = psbt->arr_len;
57925         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
57926         memcpy(psbt_ref.data, psbt->elems, psbt_ref.datalen); FREE(psbt);
57927         LDKCResult_PartiallySignedTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PartiallySignedTransactionNoneZ), "LDKCResult_PartiallySignedTransactionNoneZ");
57928         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
57929         return tag_ptr(ret_conv, true);
57930 }
57931
57932 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) {
57933         LDKKeysManager this_arg_conv;
57934         this_arg_conv.inner = untag_ptr(this_arg);
57935         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57937         this_arg_conv.is_owned = false;
57938         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
57939         descriptors_constr.datalen = descriptors->arr_len;
57940         if (descriptors_constr.datalen > 0)
57941                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
57942         else
57943                 descriptors_constr.data = NULL;
57944         uint64_t* descriptors_vals = descriptors->elems;
57945         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
57946                 uint64_t descriptors_conv_27 = descriptors_vals[b];
57947                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
57948                 CHECK_ACCESS(descriptors_conv_27_ptr);
57949                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
57950                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
57951                 descriptors_constr.data[b] = descriptors_conv_27_conv;
57952         }
57953         FREE(descriptors);
57954         LDKCVec_TxOutZ outputs_constr;
57955         outputs_constr.datalen = outputs->arr_len;
57956         if (outputs_constr.datalen > 0)
57957                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
57958         else
57959                 outputs_constr.data = NULL;
57960         uint64_t* outputs_vals = outputs->elems;
57961         for (size_t h = 0; h < outputs_constr.datalen; h++) {
57962                 uint64_t outputs_conv_7 = outputs_vals[h];
57963                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
57964                 CHECK_ACCESS(outputs_conv_7_ptr);
57965                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
57966                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
57967                 outputs_constr.data[h] = outputs_conv_7_conv;
57968         }
57969         FREE(outputs);
57970         LDKCVec_u8Z change_destination_script_ref;
57971         change_destination_script_ref.datalen = change_destination_script->arr_len;
57972         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
57973         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
57974         void* locktime_ptr = untag_ptr(locktime);
57975         CHECK_ACCESS(locktime_ptr);
57976         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
57977         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
57978         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
57979         *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
57980         return tag_ptr(ret_conv, true);
57981 }
57982
57983 uint64_t  __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) {
57984         LDKKeysManager this_arg_conv;
57985         this_arg_conv.inner = untag_ptr(this_arg);
57986         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57988         this_arg_conv.is_owned = false;
57989         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
57990         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
57991         return tag_ptr(ret_ret, true);
57992 }
57993
57994 uint64_t  __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) {
57995         LDKKeysManager this_arg_conv;
57996         this_arg_conv.inner = untag_ptr(this_arg);
57997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
57998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
57999         this_arg_conv.is_owned = false;
58000         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
58001         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
58002         return tag_ptr(ret_ret, true);
58003 }
58004
58005 uint64_t  __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) {
58006         LDKKeysManager this_arg_conv;
58007         this_arg_conv.inner = untag_ptr(this_arg);
58008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58010         this_arg_conv.is_owned = false;
58011         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
58012         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
58013         return tag_ptr(ret_ret, true);
58014 }
58015
58016 void  __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysManager_free(uint64_t this_obj) {
58017         LDKPhantomKeysManager this_obj_conv;
58018         this_obj_conv.inner = untag_ptr(this_obj);
58019         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58021         PhantomKeysManager_free(this_obj_conv);
58022 }
58023
58024 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) {
58025         LDKPhantomKeysManager this_arg_conv;
58026         this_arg_conv.inner = untag_ptr(this_arg);
58027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58029         this_arg_conv.is_owned = false;
58030         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
58031         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
58032         return tag_ptr(ret_ret, true);
58033 }
58034
58035 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) {
58036         LDKPhantomKeysManager this_arg_conv;
58037         this_arg_conv.inner = untag_ptr(this_arg);
58038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58040         this_arg_conv.is_owned = false;
58041         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
58042         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
58043         return tag_ptr(ret_ret, true);
58044 }
58045
58046 uint64_t  __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) {
58047         LDKPhantomKeysManager this_arg_conv;
58048         this_arg_conv.inner = untag_ptr(this_arg);
58049         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58051         this_arg_conv.is_owned = false;
58052         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
58053         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
58054         return tag_ptr(ret_ret, true);
58055 }
58056
58057 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) {
58058         uint8_t seed_arr[32];
58059         CHECK(seed->arr_len == 32);
58060         memcpy(seed_arr, seed->elems, 32); FREE(seed);
58061         uint8_t (*seed_ref)[32] = &seed_arr;
58062         uint8_t cross_node_seed_arr[32];
58063         CHECK(cross_node_seed->arr_len == 32);
58064         memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed);
58065         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
58066         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
58067         uint64_t ret_ref = 0;
58068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58070         return ret_ref;
58071 }
58072
58073 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) {
58074         LDKPhantomKeysManager this_arg_conv;
58075         this_arg_conv.inner = untag_ptr(this_arg);
58076         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58078         this_arg_conv.is_owned = false;
58079         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
58080         descriptors_constr.datalen = descriptors->arr_len;
58081         if (descriptors_constr.datalen > 0)
58082                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
58083         else
58084                 descriptors_constr.data = NULL;
58085         uint64_t* descriptors_vals = descriptors->elems;
58086         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
58087                 uint64_t descriptors_conv_27 = descriptors_vals[b];
58088                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
58089                 CHECK_ACCESS(descriptors_conv_27_ptr);
58090                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
58091                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
58092                 descriptors_constr.data[b] = descriptors_conv_27_conv;
58093         }
58094         FREE(descriptors);
58095         LDKCVec_TxOutZ outputs_constr;
58096         outputs_constr.datalen = outputs->arr_len;
58097         if (outputs_constr.datalen > 0)
58098                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
58099         else
58100                 outputs_constr.data = NULL;
58101         uint64_t* outputs_vals = outputs->elems;
58102         for (size_t h = 0; h < outputs_constr.datalen; h++) {
58103                 uint64_t outputs_conv_7 = outputs_vals[h];
58104                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
58105                 CHECK_ACCESS(outputs_conv_7_ptr);
58106                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
58107                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
58108                 outputs_constr.data[h] = outputs_conv_7_conv;
58109         }
58110         FREE(outputs);
58111         LDKCVec_u8Z change_destination_script_ref;
58112         change_destination_script_ref.datalen = change_destination_script->arr_len;
58113         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
58114         memcpy(change_destination_script_ref.data, change_destination_script->elems, change_destination_script_ref.datalen); FREE(change_destination_script);
58115         void* locktime_ptr = untag_ptr(locktime);
58116         CHECK_ACCESS(locktime_ptr);
58117         LDKCOption_PackedLockTimeZ locktime_conv = *(LDKCOption_PackedLockTimeZ*)(locktime_ptr);
58118         locktime_conv = COption_PackedLockTimeZ_clone((LDKCOption_PackedLockTimeZ*)untag_ptr(locktime));
58119         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
58120         *ret_conv = PhantomKeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
58121         return tag_ptr(ret_conv, true);
58122 }
58123
58124 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) {
58125         LDKPhantomKeysManager this_arg_conv;
58126         this_arg_conv.inner = untag_ptr(this_arg);
58127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58129         this_arg_conv.is_owned = false;
58130         uint8_t params_arr[32];
58131         CHECK(params->arr_len == 32);
58132         memcpy(params_arr, params->elems, 32); FREE(params);
58133         uint8_t (*params_ref)[32] = &params_arr;
58134         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
58135         uint64_t ret_ref = 0;
58136         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58137         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58138         return ret_ref;
58139 }
58140
58141 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) {
58142         LDKPhantomKeysManager this_arg_conv;
58143         this_arg_conv.inner = untag_ptr(this_arg);
58144         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58145         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58146         this_arg_conv.is_owned = false;
58147         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58148         memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32);
58149         return ret_arr;
58150 }
58151
58152 int8_tArray  __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) {
58153         LDKPhantomKeysManager this_arg_conv;
58154         this_arg_conv.inner = untag_ptr(this_arg);
58155         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58157         this_arg_conv.is_owned = false;
58158         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
58159         memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32);
58160         return ret_arr;
58161 }
58162
58163 void  __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
58164         LDKOnionMessenger this_obj_conv;
58165         this_obj_conv.inner = untag_ptr(this_obj);
58166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58168         OnionMessenger_free(this_obj_conv);
58169 }
58170
58171 void  __attribute__((export_name("TS_MessageRouter_free"))) TS_MessageRouter_free(uint64_t this_ptr) {
58172         if (!ptr_is_owned(this_ptr)) return;
58173         void* this_ptr_ptr = untag_ptr(this_ptr);
58174         CHECK_ACCESS(this_ptr_ptr);
58175         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
58176         FREE(untag_ptr(this_ptr));
58177         MessageRouter_free(this_ptr_conv);
58178 }
58179
58180 void  __attribute__((export_name("TS_DefaultMessageRouter_free"))) TS_DefaultMessageRouter_free(uint64_t this_obj) {
58181         LDKDefaultMessageRouter this_obj_conv;
58182         this_obj_conv.inner = untag_ptr(this_obj);
58183         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58185         DefaultMessageRouter_free(this_obj_conv);
58186 }
58187
58188 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_new"))) TS_DefaultMessageRouter_new() {
58189         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new();
58190         uint64_t ret_ref = 0;
58191         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58192         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58193         return ret_ref;
58194 }
58195
58196 uint64_t  __attribute__((export_name("TS_DefaultMessageRouter_as_MessageRouter"))) TS_DefaultMessageRouter_as_MessageRouter(uint64_t this_arg) {
58197         LDKDefaultMessageRouter this_arg_conv;
58198         this_arg_conv.inner = untag_ptr(this_arg);
58199         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58201         this_arg_conv.is_owned = false;
58202         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
58203         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
58204         return tag_ptr(ret_ret, true);
58205 }
58206
58207 void  __attribute__((export_name("TS_OnionMessagePath_free"))) TS_OnionMessagePath_free(uint64_t this_obj) {
58208         LDKOnionMessagePath this_obj_conv;
58209         this_obj_conv.inner = untag_ptr(this_obj);
58210         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58212         OnionMessagePath_free(this_obj_conv);
58213 }
58214
58215 ptrArray  __attribute__((export_name("TS_OnionMessagePath_get_intermediate_nodes"))) TS_OnionMessagePath_get_intermediate_nodes(uint64_t this_ptr) {
58216         LDKOnionMessagePath 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         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
58222         ptrArray ret_arr = NULL;
58223         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
58224         int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8);
58225         for (size_t m = 0; m < ret_var.datalen; m++) {
58226                 int8_tArray ret_conv_12_arr = init_int8_tArray(33, __LINE__);
58227                 memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33);
58228                 ret_arr_ptr[m] = ret_conv_12_arr;
58229         }
58230         
58231         FREE(ret_var.data);
58232         return ret_arr;
58233 }
58234
58235 void  __attribute__((export_name("TS_OnionMessagePath_set_intermediate_nodes"))) TS_OnionMessagePath_set_intermediate_nodes(uint64_t this_ptr, ptrArray val) {
58236         LDKOnionMessagePath this_ptr_conv;
58237         this_ptr_conv.inner = untag_ptr(this_ptr);
58238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58240         this_ptr_conv.is_owned = false;
58241         LDKCVec_PublicKeyZ val_constr;
58242         val_constr.datalen = val->arr_len;
58243         if (val_constr.datalen > 0)
58244                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
58245         else
58246                 val_constr.data = NULL;
58247         int8_tArray* val_vals = (void*) val->elems;
58248         for (size_t m = 0; m < val_constr.datalen; m++) {
58249                 int8_tArray val_conv_12 = val_vals[m];
58250                 LDKPublicKey val_conv_12_ref;
58251                 CHECK(val_conv_12->arr_len == 33);
58252                 memcpy(val_conv_12_ref.compressed_form, val_conv_12->elems, 33); FREE(val_conv_12);
58253                 val_constr.data[m] = val_conv_12_ref;
58254         }
58255         FREE(val);
58256         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
58257 }
58258
58259 uint64_t  __attribute__((export_name("TS_OnionMessagePath_get_destination"))) TS_OnionMessagePath_get_destination(uint64_t this_ptr) {
58260         LDKOnionMessagePath this_ptr_conv;
58261         this_ptr_conv.inner = untag_ptr(this_ptr);
58262         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58264         this_ptr_conv.is_owned = false;
58265         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58266         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
58267         uint64_t ret_ref = tag_ptr(ret_copy, true);
58268         return ret_ref;
58269 }
58270
58271 void  __attribute__((export_name("TS_OnionMessagePath_set_destination"))) TS_OnionMessagePath_set_destination(uint64_t this_ptr, uint64_t val) {
58272         LDKOnionMessagePath this_ptr_conv;
58273         this_ptr_conv.inner = untag_ptr(this_ptr);
58274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58276         this_ptr_conv.is_owned = false;
58277         void* val_ptr = untag_ptr(val);
58278         CHECK_ACCESS(val_ptr);
58279         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
58280         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
58281         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
58282 }
58283
58284 uint64_t  __attribute__((export_name("TS_OnionMessagePath_new"))) TS_OnionMessagePath_new(ptrArray intermediate_nodes_arg, uint64_t destination_arg) {
58285         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
58286         intermediate_nodes_arg_constr.datalen = intermediate_nodes_arg->arr_len;
58287         if (intermediate_nodes_arg_constr.datalen > 0)
58288                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
58289         else
58290                 intermediate_nodes_arg_constr.data = NULL;
58291         int8_tArray* intermediate_nodes_arg_vals = (void*) intermediate_nodes_arg->elems;
58292         for (size_t m = 0; m < intermediate_nodes_arg_constr.datalen; m++) {
58293                 int8_tArray intermediate_nodes_arg_conv_12 = intermediate_nodes_arg_vals[m];
58294                 LDKPublicKey intermediate_nodes_arg_conv_12_ref;
58295                 CHECK(intermediate_nodes_arg_conv_12->arr_len == 33);
58296                 memcpy(intermediate_nodes_arg_conv_12_ref.compressed_form, intermediate_nodes_arg_conv_12->elems, 33); FREE(intermediate_nodes_arg_conv_12);
58297                 intermediate_nodes_arg_constr.data[m] = intermediate_nodes_arg_conv_12_ref;
58298         }
58299         FREE(intermediate_nodes_arg);
58300         void* destination_arg_ptr = untag_ptr(destination_arg);
58301         CHECK_ACCESS(destination_arg_ptr);
58302         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
58303         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
58304         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv);
58305         uint64_t ret_ref = 0;
58306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58308         return ret_ref;
58309 }
58310
58311 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
58312         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
58313         uint64_t ret_ref = 0;
58314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58316         return ret_ref;
58317 }
58318 int64_t  __attribute__((export_name("TS_OnionMessagePath_clone_ptr"))) TS_OnionMessagePath_clone_ptr(uint64_t arg) {
58319         LDKOnionMessagePath arg_conv;
58320         arg_conv.inner = untag_ptr(arg);
58321         arg_conv.is_owned = ptr_is_owned(arg);
58322         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58323         arg_conv.is_owned = false;
58324         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
58325         return ret_conv;
58326 }
58327
58328 uint64_t  __attribute__((export_name("TS_OnionMessagePath_clone"))) TS_OnionMessagePath_clone(uint64_t orig) {
58329         LDKOnionMessagePath orig_conv;
58330         orig_conv.inner = untag_ptr(orig);
58331         orig_conv.is_owned = ptr_is_owned(orig);
58332         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58333         orig_conv.is_owned = false;
58334         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
58335         uint64_t ret_ref = 0;
58336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58338         return ret_ref;
58339 }
58340
58341 void  __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
58342         if (!ptr_is_owned(this_ptr)) return;
58343         void* this_ptr_ptr = untag_ptr(this_ptr);
58344         CHECK_ACCESS(this_ptr_ptr);
58345         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
58346         FREE(untag_ptr(this_ptr));
58347         Destination_free(this_ptr_conv);
58348 }
58349
58350 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
58351         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58352         *ret_copy = Destination_clone(arg);
58353         uint64_t ret_ref = tag_ptr(ret_copy, true);
58354         return ret_ref;
58355 }
58356 int64_t  __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
58357         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
58358         int64_t ret_conv = Destination_clone_ptr(arg_conv);
58359         return ret_conv;
58360 }
58361
58362 uint64_t  __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
58363         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
58364         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58365         *ret_copy = Destination_clone(orig_conv);
58366         uint64_t ret_ref = tag_ptr(ret_copy, true);
58367         return ret_ref;
58368 }
58369
58370 uint64_t  __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
58371         LDKPublicKey a_ref;
58372         CHECK(a->arr_len == 33);
58373         memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
58374         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58375         *ret_copy = Destination_node(a_ref);
58376         uint64_t ret_ref = tag_ptr(ret_copy, true);
58377         return ret_ref;
58378 }
58379
58380 uint64_t  __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
58381         LDKBlindedPath a_conv;
58382         a_conv.inner = untag_ptr(a);
58383         a_conv.is_owned = ptr_is_owned(a);
58384         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58385         a_conv = BlindedPath_clone(&a_conv);
58386         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
58387         *ret_copy = Destination_blinded_path(a_conv);
58388         uint64_t ret_ref = tag_ptr(ret_copy, true);
58389         return ret_ref;
58390 }
58391
58392 void  __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
58393         if (!ptr_is_owned(this_ptr)) return;
58394         void* this_ptr_ptr = untag_ptr(this_ptr);
58395         CHECK_ACCESS(this_ptr_ptr);
58396         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
58397         FREE(untag_ptr(this_ptr));
58398         SendError_free(this_ptr_conv);
58399 }
58400
58401 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
58402         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58403         *ret_copy = SendError_clone(arg);
58404         uint64_t ret_ref = tag_ptr(ret_copy, true);
58405         return ret_ref;
58406 }
58407 int64_t  __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
58408         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
58409         int64_t ret_conv = SendError_clone_ptr(arg_conv);
58410         return ret_conv;
58411 }
58412
58413 uint64_t  __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
58414         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
58415         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58416         *ret_copy = SendError_clone(orig_conv);
58417         uint64_t ret_ref = tag_ptr(ret_copy, true);
58418         return ret_ref;
58419 }
58420
58421 uint64_t  __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
58422         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
58423         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58424         *ret_copy = SendError_secp256k1(a_conv);
58425         uint64_t ret_ref = tag_ptr(ret_copy, true);
58426         return ret_ref;
58427 }
58428
58429 uint64_t  __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
58430         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58431         *ret_copy = SendError_too_big_packet();
58432         uint64_t ret_ref = tag_ptr(ret_copy, true);
58433         return ret_ref;
58434 }
58435
58436 uint64_t  __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
58437         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58438         *ret_copy = SendError_too_few_blinded_hops();
58439         uint64_t ret_ref = tag_ptr(ret_copy, true);
58440         return ret_ref;
58441 }
58442
58443 uint64_t  __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
58444         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58445         *ret_copy = SendError_invalid_first_hop();
58446         uint64_t ret_ref = tag_ptr(ret_copy, true);
58447         return ret_ref;
58448 }
58449
58450 uint64_t  __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
58451         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58452         *ret_copy = SendError_invalid_message();
58453         uint64_t ret_ref = tag_ptr(ret_copy, true);
58454         return ret_ref;
58455 }
58456
58457 uint64_t  __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
58458         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58459         *ret_copy = SendError_buffer_full();
58460         uint64_t ret_ref = tag_ptr(ret_copy, true);
58461         return ret_ref;
58462 }
58463
58464 uint64_t  __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
58465         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58466         *ret_copy = SendError_get_node_id_failed();
58467         uint64_t ret_ref = tag_ptr(ret_copy, true);
58468         return ret_ref;
58469 }
58470
58471 uint64_t  __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
58472         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
58473         *ret_copy = SendError_blinded_path_advance_failed();
58474         uint64_t ret_ref = tag_ptr(ret_copy, true);
58475         return ret_ref;
58476 }
58477
58478 jboolean  __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
58479         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
58480         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
58481         jboolean ret_conv = SendError_eq(a_conv, b_conv);
58482         return ret_conv;
58483 }
58484
58485 void  __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
58486         if (!ptr_is_owned(this_ptr)) return;
58487         void* this_ptr_ptr = untag_ptr(this_ptr);
58488         CHECK_ACCESS(this_ptr_ptr);
58489         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
58490         FREE(untag_ptr(this_ptr));
58491         CustomOnionMessageHandler_free(this_ptr_conv);
58492 }
58493
58494 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) {
58495         void* entropy_source_ptr = untag_ptr(entropy_source);
58496         CHECK_ACCESS(entropy_source_ptr);
58497         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
58498         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
58499                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58500                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
58501         }
58502         void* node_signer_ptr = untag_ptr(node_signer);
58503         CHECK_ACCESS(node_signer_ptr);
58504         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
58505         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
58506                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58507                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
58508         }
58509         void* logger_ptr = untag_ptr(logger);
58510         CHECK_ACCESS(logger_ptr);
58511         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
58512         if (logger_conv.free == LDKLogger_JCalls_free) {
58513                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58514                 LDKLogger_JCalls_cloned(&logger_conv);
58515         }
58516         void* message_router_ptr = untag_ptr(message_router);
58517         CHECK_ACCESS(message_router_ptr);
58518         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
58519         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
58520                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58521                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
58522         }
58523         void* offers_handler_ptr = untag_ptr(offers_handler);
58524         CHECK_ACCESS(offers_handler_ptr);
58525         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
58526         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
58527                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58528                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
58529         }
58530         void* custom_handler_ptr = untag_ptr(custom_handler);
58531         CHECK_ACCESS(custom_handler_ptr);
58532         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
58533         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
58534                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58535                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
58536         }
58537         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
58538         uint64_t ret_ref = 0;
58539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58541         return ret_ref;
58542 }
58543
58544 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) {
58545         LDKOnionMessenger this_arg_conv;
58546         this_arg_conv.inner = untag_ptr(this_arg);
58547         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58548         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58549         this_arg_conv.is_owned = false;
58550         LDKOnionMessagePath path_conv;
58551         path_conv.inner = untag_ptr(path);
58552         path_conv.is_owned = ptr_is_owned(path);
58553         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
58554         path_conv = OnionMessagePath_clone(&path_conv);
58555         void* message_ptr = untag_ptr(message);
58556         CHECK_ACCESS(message_ptr);
58557         LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
58558         message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
58559         LDKBlindedPath reply_path_conv;
58560         reply_path_conv.inner = untag_ptr(reply_path);
58561         reply_path_conv.is_owned = ptr_is_owned(reply_path);
58562         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
58563         reply_path_conv = BlindedPath_clone(&reply_path_conv);
58564         LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
58565         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, message_conv, reply_path_conv);
58566         return tag_ptr(ret_conv, true);
58567 }
58568
58569 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
58570         LDKOnionMessenger this_arg_conv;
58571         this_arg_conv.inner = untag_ptr(this_arg);
58572         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58574         this_arg_conv.is_owned = false;
58575         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
58576         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
58577         return tag_ptr(ret_ret, true);
58578 }
58579
58580 uint64_t  __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
58581         LDKOnionMessenger this_arg_conv;
58582         this_arg_conv.inner = untag_ptr(this_arg);
58583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
58584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
58585         this_arg_conv.is_owned = false;
58586         LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
58587         *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
58588         return tag_ptr(ret_ret, true);
58589 }
58590
58591 void  __attribute__((export_name("TS_OffersMessageHandler_free"))) TS_OffersMessageHandler_free(uint64_t this_ptr) {
58592         if (!ptr_is_owned(this_ptr)) return;
58593         void* this_ptr_ptr = untag_ptr(this_ptr);
58594         CHECK_ACCESS(this_ptr_ptr);
58595         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
58596         FREE(untag_ptr(this_ptr));
58597         OffersMessageHandler_free(this_ptr_conv);
58598 }
58599
58600 void  __attribute__((export_name("TS_OffersMessage_free"))) TS_OffersMessage_free(uint64_t this_ptr) {
58601         if (!ptr_is_owned(this_ptr)) return;
58602         void* this_ptr_ptr = untag_ptr(this_ptr);
58603         CHECK_ACCESS(this_ptr_ptr);
58604         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
58605         FREE(untag_ptr(this_ptr));
58606         OffersMessage_free(this_ptr_conv);
58607 }
58608
58609 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
58610         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58611         *ret_copy = OffersMessage_clone(arg);
58612         uint64_t ret_ref = tag_ptr(ret_copy, true);
58613         return ret_ref;
58614 }
58615 int64_t  __attribute__((export_name("TS_OffersMessage_clone_ptr"))) TS_OffersMessage_clone_ptr(uint64_t arg) {
58616         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
58617         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
58618         return ret_conv;
58619 }
58620
58621 uint64_t  __attribute__((export_name("TS_OffersMessage_clone"))) TS_OffersMessage_clone(uint64_t orig) {
58622         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
58623         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58624         *ret_copy = OffersMessage_clone(orig_conv);
58625         uint64_t ret_ref = tag_ptr(ret_copy, true);
58626         return ret_ref;
58627 }
58628
58629 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_request"))) TS_OffersMessage_invoice_request(uint64_t a) {
58630         LDKInvoiceRequest a_conv;
58631         a_conv.inner = untag_ptr(a);
58632         a_conv.is_owned = ptr_is_owned(a);
58633         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58634         a_conv = InvoiceRequest_clone(&a_conv);
58635         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58636         *ret_copy = OffersMessage_invoice_request(a_conv);
58637         uint64_t ret_ref = tag_ptr(ret_copy, true);
58638         return ret_ref;
58639 }
58640
58641 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice"))) TS_OffersMessage_invoice(uint64_t a) {
58642         LDKBolt12Invoice a_conv;
58643         a_conv.inner = untag_ptr(a);
58644         a_conv.is_owned = ptr_is_owned(a);
58645         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58646         a_conv = Bolt12Invoice_clone(&a_conv);
58647         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58648         *ret_copy = OffersMessage_invoice(a_conv);
58649         uint64_t ret_ref = tag_ptr(ret_copy, true);
58650         return ret_ref;
58651 }
58652
58653 uint64_t  __attribute__((export_name("TS_OffersMessage_invoice_error"))) TS_OffersMessage_invoice_error(uint64_t a) {
58654         LDKInvoiceError a_conv;
58655         a_conv.inner = untag_ptr(a);
58656         a_conv.is_owned = ptr_is_owned(a);
58657         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58658         a_conv = InvoiceError_clone(&a_conv);
58659         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
58660         *ret_copy = OffersMessage_invoice_error(a_conv);
58661         uint64_t ret_ref = tag_ptr(ret_copy, true);
58662         return ret_ref;
58663 }
58664
58665 jboolean  __attribute__((export_name("TS_OffersMessage_is_known_type"))) TS_OffersMessage_is_known_type(int64_t tlv_type) {
58666         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
58667         return ret_conv;
58668 }
58669
58670 int64_t  __attribute__((export_name("TS_OffersMessage_tlv_type"))) TS_OffersMessage_tlv_type(uint64_t this_arg) {
58671         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
58672         int64_t ret_conv = OffersMessage_tlv_type(this_arg_conv);
58673         return ret_conv;
58674 }
58675
58676 int8_tArray  __attribute__((export_name("TS_OffersMessage_write"))) TS_OffersMessage_write(uint64_t obj) {
58677         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
58678         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
58679         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58680         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58681         CVec_u8Z_free(ret_var);
58682         return ret_arr;
58683 }
58684
58685 uint64_t  __attribute__((export_name("TS_OffersMessage_read"))) TS_OffersMessage_read(int8_tArray ser, int64_t arg_a, uint64_t arg_b) {
58686         LDKu8slice ser_ref;
58687         ser_ref.datalen = ser->arr_len;
58688         ser_ref.data = ser->elems;
58689         void* arg_b_ptr = untag_ptr(arg_b);
58690         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
58691         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
58692         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
58693         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
58694         FREE(ser);
58695         return tag_ptr(ret_conv, true);
58696 }
58697
58698 void  __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
58699         if (!ptr_is_owned(this_ptr)) return;
58700         void* this_ptr_ptr = untag_ptr(this_ptr);
58701         CHECK_ACCESS(this_ptr_ptr);
58702         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
58703         FREE(untag_ptr(this_ptr));
58704         OnionMessageContents_free(this_ptr_conv);
58705 }
58706
58707 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
58708         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
58709         *ret_copy = OnionMessageContents_clone(arg);
58710         uint64_t ret_ref = tag_ptr(ret_copy, true);
58711         return ret_ref;
58712 }
58713 int64_t  __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
58714         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
58715         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
58716         return ret_conv;
58717 }
58718
58719 uint64_t  __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
58720         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
58721         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
58722         *ret_copy = OnionMessageContents_clone(orig_conv);
58723         uint64_t ret_ref = tag_ptr(ret_copy, true);
58724         return ret_ref;
58725 }
58726
58727 uint64_t  __attribute__((export_name("TS_OnionMessageContents_offers"))) TS_OnionMessageContents_offers(uint64_t a) {
58728         void* a_ptr = untag_ptr(a);
58729         CHECK_ACCESS(a_ptr);
58730         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
58731         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
58732         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
58733         *ret_copy = OnionMessageContents_offers(a_conv);
58734         uint64_t ret_ref = tag_ptr(ret_copy, true);
58735         return ret_ref;
58736 }
58737
58738 uint64_t  __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
58739         void* a_ptr = untag_ptr(a);
58740         CHECK_ACCESS(a_ptr);
58741         LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
58742         if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
58743                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
58744                 LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
58745         }
58746         LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
58747         *ret_copy = OnionMessageContents_custom(a_conv);
58748         uint64_t ret_ref = tag_ptr(ret_copy, true);
58749         return ret_ref;
58750 }
58751
58752 static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
58753         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
58754         *ret_ret = CustomOnionMessageContents_clone(arg);
58755         return tag_ptr(ret_ret, true);
58756 }
58757 int64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
58758         void* arg_ptr = untag_ptr(arg);
58759         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
58760         LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
58761         int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
58762         return ret_conv;
58763 }
58764
58765 uint64_t  __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
58766         void* orig_ptr = untag_ptr(orig);
58767         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
58768         LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
58769         LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
58770         *ret_ret = CustomOnionMessageContents_clone(orig_conv);
58771         return tag_ptr(ret_ret, true);
58772 }
58773
58774 void  __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
58775         if (!ptr_is_owned(this_ptr)) return;
58776         void* this_ptr_ptr = untag_ptr(this_ptr);
58777         CHECK_ACCESS(this_ptr_ptr);
58778         LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
58779         FREE(untag_ptr(this_ptr));
58780         CustomOnionMessageContents_free(this_ptr_conv);
58781 }
58782
58783 void  __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
58784         LDKBlindedPath this_obj_conv;
58785         this_obj_conv.inner = untag_ptr(this_obj);
58786         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58788         BlindedPath_free(this_obj_conv);
58789 }
58790
58791 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
58792         LDKBlindedPath ret_var = BlindedPath_clone(arg);
58793         uint64_t ret_ref = 0;
58794         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58795         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58796         return ret_ref;
58797 }
58798 int64_t  __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
58799         LDKBlindedPath arg_conv;
58800         arg_conv.inner = untag_ptr(arg);
58801         arg_conv.is_owned = ptr_is_owned(arg);
58802         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58803         arg_conv.is_owned = false;
58804         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
58805         return ret_conv;
58806 }
58807
58808 uint64_t  __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
58809         LDKBlindedPath orig_conv;
58810         orig_conv.inner = untag_ptr(orig);
58811         orig_conv.is_owned = ptr_is_owned(orig);
58812         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58813         orig_conv.is_owned = false;
58814         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
58815         uint64_t ret_ref = 0;
58816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58818         return ret_ref;
58819 }
58820
58821 int64_t  __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
58822         LDKBlindedPath o_conv;
58823         o_conv.inner = untag_ptr(o);
58824         o_conv.is_owned = ptr_is_owned(o);
58825         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58826         o_conv.is_owned = false;
58827         int64_t ret_conv = BlindedPath_hash(&o_conv);
58828         return ret_conv;
58829 }
58830
58831 jboolean  __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
58832         LDKBlindedPath a_conv;
58833         a_conv.inner = untag_ptr(a);
58834         a_conv.is_owned = ptr_is_owned(a);
58835         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58836         a_conv.is_owned = false;
58837         LDKBlindedPath b_conv;
58838         b_conv.inner = untag_ptr(b);
58839         b_conv.is_owned = ptr_is_owned(b);
58840         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58841         b_conv.is_owned = false;
58842         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
58843         return ret_conv;
58844 }
58845
58846 void  __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
58847         LDKBlindedHop this_obj_conv;
58848         this_obj_conv.inner = untag_ptr(this_obj);
58849         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58850         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58851         BlindedHop_free(this_obj_conv);
58852 }
58853
58854 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
58855         LDKBlindedHop ret_var = BlindedHop_clone(arg);
58856         uint64_t ret_ref = 0;
58857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58859         return ret_ref;
58860 }
58861 int64_t  __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
58862         LDKBlindedHop arg_conv;
58863         arg_conv.inner = untag_ptr(arg);
58864         arg_conv.is_owned = ptr_is_owned(arg);
58865         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58866         arg_conv.is_owned = false;
58867         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
58868         return ret_conv;
58869 }
58870
58871 uint64_t  __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
58872         LDKBlindedHop orig_conv;
58873         orig_conv.inner = untag_ptr(orig);
58874         orig_conv.is_owned = ptr_is_owned(orig);
58875         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58876         orig_conv.is_owned = false;
58877         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
58878         uint64_t ret_ref = 0;
58879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58881         return ret_ref;
58882 }
58883
58884 int64_t  __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
58885         LDKBlindedHop o_conv;
58886         o_conv.inner = untag_ptr(o);
58887         o_conv.is_owned = ptr_is_owned(o);
58888         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58889         o_conv.is_owned = false;
58890         int64_t ret_conv = BlindedHop_hash(&o_conv);
58891         return ret_conv;
58892 }
58893
58894 jboolean  __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
58895         LDKBlindedHop a_conv;
58896         a_conv.inner = untag_ptr(a);
58897         a_conv.is_owned = ptr_is_owned(a);
58898         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58899         a_conv.is_owned = false;
58900         LDKBlindedHop b_conv;
58901         b_conv.inner = untag_ptr(b);
58902         b_conv.is_owned = ptr_is_owned(b);
58903         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58904         b_conv.is_owned = false;
58905         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
58906         return ret_conv;
58907 }
58908
58909 uint64_t  __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
58910         LDKCVec_PublicKeyZ node_pks_constr;
58911         node_pks_constr.datalen = node_pks->arr_len;
58912         if (node_pks_constr.datalen > 0)
58913                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
58914         else
58915                 node_pks_constr.data = NULL;
58916         int8_tArray* node_pks_vals = (void*) node_pks->elems;
58917         for (size_t m = 0; m < node_pks_constr.datalen; m++) {
58918                 int8_tArray node_pks_conv_12 = node_pks_vals[m];
58919                 LDKPublicKey node_pks_conv_12_ref;
58920                 CHECK(node_pks_conv_12->arr_len == 33);
58921                 memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
58922                 node_pks_constr.data[m] = node_pks_conv_12_ref;
58923         }
58924         FREE(node_pks);
58925         void* entropy_source_ptr = untag_ptr(entropy_source);
58926         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
58927         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
58928         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
58929         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
58930         return tag_ptr(ret_conv, true);
58931 }
58932
58933 int8_tArray  __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
58934         LDKBlindedPath obj_conv;
58935         obj_conv.inner = untag_ptr(obj);
58936         obj_conv.is_owned = ptr_is_owned(obj);
58937         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58938         obj_conv.is_owned = false;
58939         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
58940         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58941         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58942         CVec_u8Z_free(ret_var);
58943         return ret_arr;
58944 }
58945
58946 uint64_t  __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
58947         LDKu8slice ser_ref;
58948         ser_ref.datalen = ser->arr_len;
58949         ser_ref.data = ser->elems;
58950         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
58951         *ret_conv = BlindedPath_read(ser_ref);
58952         FREE(ser);
58953         return tag_ptr(ret_conv, true);
58954 }
58955
58956 int8_tArray  __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
58957         LDKBlindedHop obj_conv;
58958         obj_conv.inner = untag_ptr(obj);
58959         obj_conv.is_owned = ptr_is_owned(obj);
58960         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
58961         obj_conv.is_owned = false;
58962         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
58963         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
58964         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
58965         CVec_u8Z_free(ret_var);
58966         return ret_arr;
58967 }
58968
58969 uint64_t  __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
58970         LDKu8slice ser_ref;
58971         ser_ref.datalen = ser->arr_len;
58972         ser_ref.data = ser->elems;
58973         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
58974         *ret_conv = BlindedHop_read(ser_ref);
58975         FREE(ser);
58976         return tag_ptr(ret_conv, true);
58977 }
58978
58979 void  __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
58980         if (!ptr_is_owned(this_ptr)) return;
58981         void* this_ptr_ptr = untag_ptr(this_ptr);
58982         CHECK_ACCESS(this_ptr_ptr);
58983         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
58984         FREE(untag_ptr(this_ptr));
58985         PaymentPurpose_free(this_ptr_conv);
58986 }
58987
58988 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
58989         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
58990         *ret_copy = PaymentPurpose_clone(arg);
58991         uint64_t ret_ref = tag_ptr(ret_copy, true);
58992         return ret_ref;
58993 }
58994 int64_t  __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
58995         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
58996         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
58997         return ret_conv;
58998 }
58999
59000 uint64_t  __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
59001         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
59002         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
59003         *ret_copy = PaymentPurpose_clone(orig_conv);
59004         uint64_t ret_ref = tag_ptr(ret_copy, true);
59005         return ret_ref;
59006 }
59007
59008 uint64_t  __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(uint64_t payment_preimage, int8_tArray payment_secret) {
59009         void* payment_preimage_ptr = untag_ptr(payment_preimage);
59010         CHECK_ACCESS(payment_preimage_ptr);
59011         LDKCOption_PaymentPreimageZ payment_preimage_conv = *(LDKCOption_PaymentPreimageZ*)(payment_preimage_ptr);
59012         payment_preimage_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(payment_preimage));
59013         LDKThirtyTwoBytes payment_secret_ref;
59014         CHECK(payment_secret->arr_len == 32);
59015         memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
59016         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
59017         *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_conv, payment_secret_ref);
59018         uint64_t ret_ref = tag_ptr(ret_copy, true);
59019         return ret_ref;
59020 }
59021
59022 uint64_t  __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
59023         LDKThirtyTwoBytes a_ref;
59024         CHECK(a->arr_len == 32);
59025         memcpy(a_ref.data, a->elems, 32); FREE(a);
59026         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
59027         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
59028         uint64_t ret_ref = tag_ptr(ret_copy, true);
59029         return ret_ref;
59030 }
59031
59032 jboolean  __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
59033         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
59034         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
59035         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
59036         return ret_conv;
59037 }
59038
59039 int8_tArray  __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
59040         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
59041         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
59042         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59043         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59044         CVec_u8Z_free(ret_var);
59045         return ret_arr;
59046 }
59047
59048 uint64_t  __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
59049         LDKu8slice ser_ref;
59050         ser_ref.datalen = ser->arr_len;
59051         ser_ref.data = ser->elems;
59052         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
59053         *ret_conv = PaymentPurpose_read(ser_ref);
59054         FREE(ser);
59055         return tag_ptr(ret_conv, true);
59056 }
59057
59058 void  __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
59059         if (!ptr_is_owned(this_ptr)) return;
59060         void* this_ptr_ptr = untag_ptr(this_ptr);
59061         CHECK_ACCESS(this_ptr_ptr);
59062         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
59063         FREE(untag_ptr(this_ptr));
59064         PathFailure_free(this_ptr_conv);
59065 }
59066
59067 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
59068         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
59069         *ret_copy = PathFailure_clone(arg);
59070         uint64_t ret_ref = tag_ptr(ret_copy, true);
59071         return ret_ref;
59072 }
59073 int64_t  __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
59074         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
59075         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
59076         return ret_conv;
59077 }
59078
59079 uint64_t  __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
59080         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
59081         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
59082         *ret_copy = PathFailure_clone(orig_conv);
59083         uint64_t ret_ref = tag_ptr(ret_copy, true);
59084         return ret_ref;
59085 }
59086
59087 uint64_t  __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
59088         void* err_ptr = untag_ptr(err);
59089         CHECK_ACCESS(err_ptr);
59090         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
59091         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
59092         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
59093         *ret_copy = PathFailure_initial_send(err_conv);
59094         uint64_t ret_ref = tag_ptr(ret_copy, true);
59095         return ret_ref;
59096 }
59097
59098 uint64_t  __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
59099         void* network_update_ptr = untag_ptr(network_update);
59100         CHECK_ACCESS(network_update_ptr);
59101         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
59102         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
59103         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
59104         *ret_copy = PathFailure_on_path(network_update_conv);
59105         uint64_t ret_ref = tag_ptr(ret_copy, true);
59106         return ret_ref;
59107 }
59108
59109 jboolean  __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
59110         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
59111         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
59112         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
59113         return ret_conv;
59114 }
59115
59116 int8_tArray  __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
59117         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
59118         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
59119         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59120         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59121         CVec_u8Z_free(ret_var);
59122         return ret_arr;
59123 }
59124
59125 uint64_t  __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
59126         LDKu8slice ser_ref;
59127         ser_ref.datalen = ser->arr_len;
59128         ser_ref.data = ser->elems;
59129         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
59130         *ret_conv = PathFailure_read(ser_ref);
59131         FREE(ser);
59132         return tag_ptr(ret_conv, true);
59133 }
59134
59135 void  __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
59136         if (!ptr_is_owned(this_ptr)) return;
59137         void* this_ptr_ptr = untag_ptr(this_ptr);
59138         CHECK_ACCESS(this_ptr_ptr);
59139         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
59140         FREE(untag_ptr(this_ptr));
59141         ClosureReason_free(this_ptr_conv);
59142 }
59143
59144 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
59145         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59146         *ret_copy = ClosureReason_clone(arg);
59147         uint64_t ret_ref = tag_ptr(ret_copy, true);
59148         return ret_ref;
59149 }
59150 int64_t  __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
59151         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
59152         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
59153         return ret_conv;
59154 }
59155
59156 uint64_t  __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
59157         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
59158         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59159         *ret_copy = ClosureReason_clone(orig_conv);
59160         uint64_t ret_ref = tag_ptr(ret_copy, true);
59161         return ret_ref;
59162 }
59163
59164 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
59165         LDKUntrustedString peer_msg_conv;
59166         peer_msg_conv.inner = untag_ptr(peer_msg);
59167         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
59168         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
59169         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
59170         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59171         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
59172         uint64_t ret_ref = tag_ptr(ret_copy, true);
59173         return ret_ref;
59174 }
59175
59176 uint64_t  __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
59177         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59178         *ret_copy = ClosureReason_holder_force_closed();
59179         uint64_t ret_ref = tag_ptr(ret_copy, true);
59180         return ret_ref;
59181 }
59182
59183 uint64_t  __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
59184         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59185         *ret_copy = ClosureReason_cooperative_closure();
59186         uint64_t ret_ref = tag_ptr(ret_copy, true);
59187         return ret_ref;
59188 }
59189
59190 uint64_t  __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
59191         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59192         *ret_copy = ClosureReason_commitment_tx_confirmed();
59193         uint64_t ret_ref = tag_ptr(ret_copy, true);
59194         return ret_ref;
59195 }
59196
59197 uint64_t  __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
59198         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59199         *ret_copy = ClosureReason_funding_timed_out();
59200         uint64_t ret_ref = tag_ptr(ret_copy, true);
59201         return ret_ref;
59202 }
59203
59204 uint64_t  __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
59205         LDKStr err_conv = str_ref_to_owned_c(err);
59206         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59207         *ret_copy = ClosureReason_processing_error(err_conv);
59208         uint64_t ret_ref = tag_ptr(ret_copy, true);
59209         return ret_ref;
59210 }
59211
59212 uint64_t  __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
59213         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59214         *ret_copy = ClosureReason_disconnected_peer();
59215         uint64_t ret_ref = tag_ptr(ret_copy, true);
59216         return ret_ref;
59217 }
59218
59219 uint64_t  __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
59220         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59221         *ret_copy = ClosureReason_outdated_channel_manager();
59222         uint64_t ret_ref = tag_ptr(ret_copy, true);
59223         return ret_ref;
59224 }
59225
59226 uint64_t  __attribute__((export_name("TS_ClosureReason_counterparty_coop_closed_unfunded_channel"))) TS_ClosureReason_counterparty_coop_closed_unfunded_channel() {
59227         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
59228         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
59229         uint64_t ret_ref = tag_ptr(ret_copy, true);
59230         return ret_ref;
59231 }
59232
59233 jboolean  __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
59234         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
59235         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
59236         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
59237         return ret_conv;
59238 }
59239
59240 int8_tArray  __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
59241         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
59242         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
59243         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59244         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59245         CVec_u8Z_free(ret_var);
59246         return ret_arr;
59247 }
59248
59249 uint64_t  __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
59250         LDKu8slice ser_ref;
59251         ser_ref.datalen = ser->arr_len;
59252         ser_ref.data = ser->elems;
59253         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
59254         *ret_conv = ClosureReason_read(ser_ref);
59255         FREE(ser);
59256         return tag_ptr(ret_conv, true);
59257 }
59258
59259 void  __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
59260         if (!ptr_is_owned(this_ptr)) return;
59261         void* this_ptr_ptr = untag_ptr(this_ptr);
59262         CHECK_ACCESS(this_ptr_ptr);
59263         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
59264         FREE(untag_ptr(this_ptr));
59265         HTLCDestination_free(this_ptr_conv);
59266 }
59267
59268 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
59269         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59270         *ret_copy = HTLCDestination_clone(arg);
59271         uint64_t ret_ref = tag_ptr(ret_copy, true);
59272         return ret_ref;
59273 }
59274 int64_t  __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
59275         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
59276         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
59277         return ret_conv;
59278 }
59279
59280 uint64_t  __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
59281         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
59282         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59283         *ret_copy = HTLCDestination_clone(orig_conv);
59284         uint64_t ret_ref = tag_ptr(ret_copy, true);
59285         return ret_ref;
59286 }
59287
59288 uint64_t  __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
59289         LDKPublicKey node_id_ref;
59290         CHECK(node_id->arr_len == 33);
59291         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59292         LDKThirtyTwoBytes channel_id_ref;
59293         CHECK(channel_id->arr_len == 32);
59294         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59295         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59296         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
59297         uint64_t ret_ref = tag_ptr(ret_copy, true);
59298         return ret_ref;
59299 }
59300
59301 uint64_t  __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
59302         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59303         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
59304         uint64_t ret_ref = tag_ptr(ret_copy, true);
59305         return ret_ref;
59306 }
59307
59308 uint64_t  __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
59309         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59310         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
59311         uint64_t ret_ref = tag_ptr(ret_copy, true);
59312         return ret_ref;
59313 }
59314
59315 uint64_t  __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
59316         LDKThirtyTwoBytes payment_hash_ref;
59317         CHECK(payment_hash->arr_len == 32);
59318         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59319         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
59320         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
59321         uint64_t ret_ref = tag_ptr(ret_copy, true);
59322         return ret_ref;
59323 }
59324
59325 jboolean  __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
59326         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
59327         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
59328         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
59329         return ret_conv;
59330 }
59331
59332 int8_tArray  __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
59333         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
59334         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
59335         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59336         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59337         CVec_u8Z_free(ret_var);
59338         return ret_arr;
59339 }
59340
59341 uint64_t  __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
59342         LDKu8slice ser_ref;
59343         ser_ref.datalen = ser->arr_len;
59344         ser_ref.data = ser->elems;
59345         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
59346         *ret_conv = HTLCDestination_read(ser_ref);
59347         FREE(ser);
59348         return tag_ptr(ret_conv, true);
59349 }
59350
59351 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
59352         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
59353         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
59354         return ret_conv;
59355 }
59356
59357 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
59358         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
59359         return ret_conv;
59360 }
59361
59362 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
59363         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
59364         return ret_conv;
59365 }
59366
59367 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
59368         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
59369         return ret_conv;
59370 }
59371
59372 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
59373         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
59374         return ret_conv;
59375 }
59376
59377 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
59378         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
59379         return ret_conv;
59380 }
59381
59382 uint32_t  __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
59383         uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
59384         return ret_conv;
59385 }
59386
59387 jboolean  __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
59388         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
59389         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
59390         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
59391         return ret_conv;
59392 }
59393
59394 int8_tArray  __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
59395         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
59396         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
59397         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59398         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59399         CVec_u8Z_free(ret_var);
59400         return ret_arr;
59401 }
59402
59403 uint64_t  __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
59404         LDKu8slice ser_ref;
59405         ser_ref.datalen = ser->arr_len;
59406         ser_ref.data = ser->elems;
59407         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
59408         *ret_conv = PaymentFailureReason_read(ser_ref);
59409         FREE(ser);
59410         return tag_ptr(ret_conv, true);
59411 }
59412
59413 void  __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
59414         if (!ptr_is_owned(this_ptr)) return;
59415         void* this_ptr_ptr = untag_ptr(this_ptr);
59416         CHECK_ACCESS(this_ptr_ptr);
59417         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
59418         FREE(untag_ptr(this_ptr));
59419         Event_free(this_ptr_conv);
59420 }
59421
59422 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
59423         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59424         *ret_copy = Event_clone(arg);
59425         uint64_t ret_ref = tag_ptr(ret_copy, true);
59426         return ret_ref;
59427 }
59428 int64_t  __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
59429         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
59430         int64_t ret_conv = Event_clone_ptr(arg_conv);
59431         return ret_conv;
59432 }
59433
59434 uint64_t  __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
59435         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
59436         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59437         *ret_copy = Event_clone(orig_conv);
59438         uint64_t ret_ref = tag_ptr(ret_copy, true);
59439         return ret_ref;
59440 }
59441
59442 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) {
59443         LDKThirtyTwoBytes temporary_channel_id_ref;
59444         CHECK(temporary_channel_id->arr_len == 32);
59445         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
59446         LDKPublicKey counterparty_node_id_ref;
59447         CHECK(counterparty_node_id->arr_len == 33);
59448         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
59449         LDKCVec_u8Z output_script_ref;
59450         output_script_ref.datalen = output_script->arr_len;
59451         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
59452         memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
59453         LDKU128 user_channel_id_ref;
59454         CHECK(user_channel_id->arr_len == 16);
59455         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
59456         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59457         *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
59458         uint64_t ret_ref = tag_ptr(ret_copy, true);
59459         return ret_ref;
59460 }
59461
59462 uint64_t  __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, uint64_t onion_fields, int64_t amount_msat, int64_t counterparty_skimmed_fee_msat, uint64_t purpose, int8_tArray via_channel_id, uint64_t via_user_channel_id, uint64_t claim_deadline) {
59463         LDKPublicKey receiver_node_id_ref;
59464         CHECK(receiver_node_id->arr_len == 33);
59465         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
59466         LDKThirtyTwoBytes payment_hash_ref;
59467         CHECK(payment_hash->arr_len == 32);
59468         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59469         LDKRecipientOnionFields onion_fields_conv;
59470         onion_fields_conv.inner = untag_ptr(onion_fields);
59471         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
59472         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
59473         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
59474         void* purpose_ptr = untag_ptr(purpose);
59475         CHECK_ACCESS(purpose_ptr);
59476         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
59477         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
59478         LDKThirtyTwoBytes via_channel_id_ref;
59479         CHECK(via_channel_id->arr_len == 32);
59480         memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
59481         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
59482         CHECK_ACCESS(via_user_channel_id_ptr);
59483         LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
59484         via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
59485         void* claim_deadline_ptr = untag_ptr(claim_deadline);
59486         CHECK_ACCESS(claim_deadline_ptr);
59487         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
59488         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
59489         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59490         *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, counterparty_skimmed_fee_msat, purpose_conv, via_channel_id_ref, via_user_channel_id_conv, claim_deadline_conv);
59491         uint64_t ret_ref = tag_ptr(ret_copy, true);
59492         return ret_ref;
59493 }
59494
59495 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) {
59496         LDKPublicKey receiver_node_id_ref;
59497         CHECK(receiver_node_id->arr_len == 33);
59498         memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
59499         LDKThirtyTwoBytes payment_hash_ref;
59500         CHECK(payment_hash->arr_len == 32);
59501         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59502         void* purpose_ptr = untag_ptr(purpose);
59503         CHECK_ACCESS(purpose_ptr);
59504         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
59505         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
59506         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59507         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
59508         uint64_t ret_ref = tag_ptr(ret_copy, true);
59509         return ret_ref;
59510 }
59511
59512 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) {
59513         void* payment_id_ptr = untag_ptr(payment_id);
59514         CHECK_ACCESS(payment_id_ptr);
59515         LDKCOption_PaymentIdZ payment_id_conv = *(LDKCOption_PaymentIdZ*)(payment_id_ptr);
59516         payment_id_conv = COption_PaymentIdZ_clone((LDKCOption_PaymentIdZ*)untag_ptr(payment_id));
59517         LDKThirtyTwoBytes payment_preimage_ref;
59518         CHECK(payment_preimage->arr_len == 32);
59519         memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
59520         LDKThirtyTwoBytes payment_hash_ref;
59521         CHECK(payment_hash->arr_len == 32);
59522         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59523         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
59524         CHECK_ACCESS(fee_paid_msat_ptr);
59525         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
59526         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
59527         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59528         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
59529         uint64_t ret_ref = tag_ptr(ret_copy, true);
59530         return ret_ref;
59531 }
59532
59533 uint64_t  __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
59534         LDKThirtyTwoBytes payment_id_ref;
59535         CHECK(payment_id->arr_len == 32);
59536         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
59537         LDKThirtyTwoBytes payment_hash_ref;
59538         CHECK(payment_hash->arr_len == 32);
59539         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59540         void* reason_ptr = untag_ptr(reason);
59541         CHECK_ACCESS(reason_ptr);
59542         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
59543         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
59544         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59545         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
59546         uint64_t ret_ref = tag_ptr(ret_copy, true);
59547         return ret_ref;
59548 }
59549
59550 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) {
59551         LDKThirtyTwoBytes payment_id_ref;
59552         CHECK(payment_id->arr_len == 32);
59553         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
59554         void* payment_hash_ptr = untag_ptr(payment_hash);
59555         CHECK_ACCESS(payment_hash_ptr);
59556         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
59557         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
59558         LDKPath path_conv;
59559         path_conv.inner = untag_ptr(path);
59560         path_conv.is_owned = ptr_is_owned(path);
59561         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59562         path_conv = Path_clone(&path_conv);
59563         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59564         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
59565         uint64_t ret_ref = tag_ptr(ret_copy, true);
59566         return ret_ref;
59567 }
59568
59569 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) {
59570         void* payment_id_ptr = untag_ptr(payment_id);
59571         CHECK_ACCESS(payment_id_ptr);
59572         LDKCOption_PaymentIdZ payment_id_conv = *(LDKCOption_PaymentIdZ*)(payment_id_ptr);
59573         payment_id_conv = COption_PaymentIdZ_clone((LDKCOption_PaymentIdZ*)untag_ptr(payment_id));
59574         LDKThirtyTwoBytes payment_hash_ref;
59575         CHECK(payment_hash->arr_len == 32);
59576         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59577         void* failure_ptr = untag_ptr(failure);
59578         CHECK_ACCESS(failure_ptr);
59579         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
59580         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
59581         LDKPath path_conv;
59582         path_conv.inner = untag_ptr(path);
59583         path_conv.is_owned = ptr_is_owned(path);
59584         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59585         path_conv = Path_clone(&path_conv);
59586         void* short_channel_id_ptr = untag_ptr(short_channel_id);
59587         CHECK_ACCESS(short_channel_id_ptr);
59588         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
59589         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
59590         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59591         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
59592         uint64_t ret_ref = tag_ptr(ret_copy, true);
59593         return ret_ref;
59594 }
59595
59596 uint64_t  __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
59597         LDKThirtyTwoBytes payment_id_ref;
59598         CHECK(payment_id->arr_len == 32);
59599         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
59600         LDKThirtyTwoBytes payment_hash_ref;
59601         CHECK(payment_hash->arr_len == 32);
59602         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59603         LDKPath path_conv;
59604         path_conv.inner = untag_ptr(path);
59605         path_conv.is_owned = ptr_is_owned(path);
59606         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59607         path_conv = Path_clone(&path_conv);
59608         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59609         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
59610         uint64_t ret_ref = tag_ptr(ret_copy, true);
59611         return ret_ref;
59612 }
59613
59614 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) {
59615         LDKThirtyTwoBytes payment_id_ref;
59616         CHECK(payment_id->arr_len == 32);
59617         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
59618         LDKThirtyTwoBytes payment_hash_ref;
59619         CHECK(payment_hash->arr_len == 32);
59620         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59621         LDKPath path_conv;
59622         path_conv.inner = untag_ptr(path);
59623         path_conv.is_owned = ptr_is_owned(path);
59624         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
59625         path_conv = Path_clone(&path_conv);
59626         void* short_channel_id_ptr = untag_ptr(short_channel_id);
59627         CHECK_ACCESS(short_channel_id_ptr);
59628         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
59629         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
59630         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59631         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
59632         uint64_t ret_ref = tag_ptr(ret_copy, true);
59633         return ret_ref;
59634 }
59635
59636 uint64_t  __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
59637         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59638         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
59639         uint64_t ret_ref = tag_ptr(ret_copy, true);
59640         return ret_ref;
59641 }
59642
59643 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) {
59644         LDKThirtyTwoBytes intercept_id_ref;
59645         CHECK(intercept_id->arr_len == 32);
59646         memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
59647         LDKThirtyTwoBytes payment_hash_ref;
59648         CHECK(payment_hash->arr_len == 32);
59649         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
59650         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59651         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
59652         uint64_t ret_ref = tag_ptr(ret_copy, true);
59653         return ret_ref;
59654 }
59655
59656 uint64_t  __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
59657         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
59658         outputs_constr.datalen = outputs->arr_len;
59659         if (outputs_constr.datalen > 0)
59660                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
59661         else
59662                 outputs_constr.data = NULL;
59663         uint64_t* outputs_vals = outputs->elems;
59664         for (size_t b = 0; b < outputs_constr.datalen; b++) {
59665                 uint64_t outputs_conv_27 = outputs_vals[b];
59666                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
59667                 CHECK_ACCESS(outputs_conv_27_ptr);
59668                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
59669                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
59670                 outputs_constr.data[b] = outputs_conv_27_conv;
59671         }
59672         FREE(outputs);
59673         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59674         *ret_copy = Event_spendable_outputs(outputs_constr);
59675         uint64_t ret_ref = tag_ptr(ret_copy, true);
59676         return ret_ref;
59677 }
59678
59679 uint64_t  __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(int8_tArray prev_channel_id, int8_tArray next_channel_id, uint64_t fee_earned_msat, jboolean claim_from_onchain_tx, uint64_t outbound_amount_forwarded_msat) {
59680         LDKThirtyTwoBytes prev_channel_id_ref;
59681         CHECK(prev_channel_id->arr_len == 32);
59682         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
59683         LDKThirtyTwoBytes next_channel_id_ref;
59684         CHECK(next_channel_id->arr_len == 32);
59685         memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
59686         void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
59687         CHECK_ACCESS(fee_earned_msat_ptr);
59688         LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
59689         fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
59690         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
59691         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
59692         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
59693         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
59694         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59695         *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
59696         uint64_t ret_ref = tag_ptr(ret_copy, true);
59697         return ret_ref;
59698 }
59699
59700 uint64_t  __attribute__((export_name("TS_Event_channel_pending"))) TS_Event_channel_pending(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray former_temporary_channel_id, int8_tArray counterparty_node_id, uint64_t funding_txo) {
59701         LDKThirtyTwoBytes channel_id_ref;
59702         CHECK(channel_id->arr_len == 32);
59703         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59704         LDKU128 user_channel_id_ref;
59705         CHECK(user_channel_id->arr_len == 16);
59706         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
59707         LDKThirtyTwoBytes former_temporary_channel_id_ref;
59708         CHECK(former_temporary_channel_id->arr_len == 32);
59709         memcpy(former_temporary_channel_id_ref.data, former_temporary_channel_id->elems, 32); FREE(former_temporary_channel_id);
59710         LDKPublicKey counterparty_node_id_ref;
59711         CHECK(counterparty_node_id->arr_len == 33);
59712         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
59713         LDKOutPoint funding_txo_conv;
59714         funding_txo_conv.inner = untag_ptr(funding_txo);
59715         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
59716         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
59717         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
59718         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59719         *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_ref, counterparty_node_id_ref, funding_txo_conv);
59720         uint64_t ret_ref = tag_ptr(ret_copy, true);
59721         return ret_ref;
59722 }
59723
59724 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) {
59725         LDKThirtyTwoBytes channel_id_ref;
59726         CHECK(channel_id->arr_len == 32);
59727         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59728         LDKU128 user_channel_id_ref;
59729         CHECK(user_channel_id->arr_len == 16);
59730         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
59731         LDKPublicKey counterparty_node_id_ref;
59732         CHECK(counterparty_node_id->arr_len == 33);
59733         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
59734         LDKChannelTypeFeatures channel_type_conv;
59735         channel_type_conv.inner = untag_ptr(channel_type);
59736         channel_type_conv.is_owned = ptr_is_owned(channel_type);
59737         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
59738         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
59739         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59740         *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
59741         uint64_t ret_ref = tag_ptr(ret_copy, true);
59742         return ret_ref;
59743 }
59744
59745 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) {
59746         LDKThirtyTwoBytes channel_id_ref;
59747         CHECK(channel_id->arr_len == 32);
59748         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59749         LDKU128 user_channel_id_ref;
59750         CHECK(user_channel_id->arr_len == 16);
59751         memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
59752         void* reason_ptr = untag_ptr(reason);
59753         CHECK_ACCESS(reason_ptr);
59754         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
59755         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
59756         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59757         *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
59758         uint64_t ret_ref = tag_ptr(ret_copy, true);
59759         return ret_ref;
59760 }
59761
59762 uint64_t  __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
59763         LDKThirtyTwoBytes channel_id_ref;
59764         CHECK(channel_id->arr_len == 32);
59765         memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
59766         LDKTransaction transaction_ref;
59767         transaction_ref.datalen = transaction->arr_len;
59768         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
59769         memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
59770         transaction_ref.data_is_owned = true;
59771         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59772         *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
59773         uint64_t ret_ref = tag_ptr(ret_copy, true);
59774         return ret_ref;
59775 }
59776
59777 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) {
59778         LDKThirtyTwoBytes temporary_channel_id_ref;
59779         CHECK(temporary_channel_id->arr_len == 32);
59780         memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
59781         LDKPublicKey counterparty_node_id_ref;
59782         CHECK(counterparty_node_id->arr_len == 33);
59783         memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
59784         LDKChannelTypeFeatures channel_type_conv;
59785         channel_type_conv.inner = untag_ptr(channel_type);
59786         channel_type_conv.is_owned = ptr_is_owned(channel_type);
59787         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
59788         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
59789         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59790         *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
59791         uint64_t ret_ref = tag_ptr(ret_copy, true);
59792         return ret_ref;
59793 }
59794
59795 uint64_t  __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
59796         LDKThirtyTwoBytes prev_channel_id_ref;
59797         CHECK(prev_channel_id->arr_len == 32);
59798         memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
59799         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
59800         CHECK_ACCESS(failed_next_destination_ptr);
59801         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
59802         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
59803         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59804         *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
59805         uint64_t ret_ref = tag_ptr(ret_copy, true);
59806         return ret_ref;
59807 }
59808
59809 uint64_t  __attribute__((export_name("TS_Event_bump_transaction"))) TS_Event_bump_transaction(uint64_t a) {
59810         void* a_ptr = untag_ptr(a);
59811         CHECK_ACCESS(a_ptr);
59812         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
59813         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
59814         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
59815         *ret_copy = Event_bump_transaction(a_conv);
59816         uint64_t ret_ref = tag_ptr(ret_copy, true);
59817         return ret_ref;
59818 }
59819
59820 jboolean  __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
59821         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
59822         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
59823         jboolean ret_conv = Event_eq(a_conv, b_conv);
59824         return ret_conv;
59825 }
59826
59827 int8_tArray  __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
59828         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
59829         LDKCVec_u8Z ret_var = Event_write(obj_conv);
59830         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
59831         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
59832         CVec_u8Z_free(ret_var);
59833         return ret_arr;
59834 }
59835
59836 uint64_t  __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
59837         LDKu8slice ser_ref;
59838         ser_ref.datalen = ser->arr_len;
59839         ser_ref.data = ser->elems;
59840         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
59841         *ret_conv = Event_read(ser_ref);
59842         FREE(ser);
59843         return tag_ptr(ret_conv, true);
59844 }
59845
59846 void  __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
59847         if (!ptr_is_owned(this_ptr)) return;
59848         void* this_ptr_ptr = untag_ptr(this_ptr);
59849         CHECK_ACCESS(this_ptr_ptr);
59850         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
59851         FREE(untag_ptr(this_ptr));
59852         MessageSendEvent_free(this_ptr_conv);
59853 }
59854
59855 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
59856         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59857         *ret_copy = MessageSendEvent_clone(arg);
59858         uint64_t ret_ref = tag_ptr(ret_copy, true);
59859         return ret_ref;
59860 }
59861 int64_t  __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
59862         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
59863         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
59864         return ret_conv;
59865 }
59866
59867 uint64_t  __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
59868         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
59869         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59870         *ret_copy = MessageSendEvent_clone(orig_conv);
59871         uint64_t ret_ref = tag_ptr(ret_copy, true);
59872         return ret_ref;
59873 }
59874
59875 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
59876         LDKPublicKey node_id_ref;
59877         CHECK(node_id->arr_len == 33);
59878         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59879         LDKAcceptChannel msg_conv;
59880         msg_conv.inner = untag_ptr(msg);
59881         msg_conv.is_owned = ptr_is_owned(msg);
59882         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59883         msg_conv = AcceptChannel_clone(&msg_conv);
59884         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59885         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
59886         uint64_t ret_ref = tag_ptr(ret_copy, true);
59887         return ret_ref;
59888 }
59889
59890 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_accept_channel_v2"))) TS_MessageSendEvent_send_accept_channel_v2(int8_tArray node_id, uint64_t msg) {
59891         LDKPublicKey node_id_ref;
59892         CHECK(node_id->arr_len == 33);
59893         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59894         LDKAcceptChannelV2 msg_conv;
59895         msg_conv.inner = untag_ptr(msg);
59896         msg_conv.is_owned = ptr_is_owned(msg);
59897         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59898         msg_conv = AcceptChannelV2_clone(&msg_conv);
59899         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59900         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
59901         uint64_t ret_ref = tag_ptr(ret_copy, true);
59902         return ret_ref;
59903 }
59904
59905 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
59906         LDKPublicKey node_id_ref;
59907         CHECK(node_id->arr_len == 33);
59908         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59909         LDKOpenChannel msg_conv;
59910         msg_conv.inner = untag_ptr(msg);
59911         msg_conv.is_owned = ptr_is_owned(msg);
59912         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59913         msg_conv = OpenChannel_clone(&msg_conv);
59914         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59915         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
59916         uint64_t ret_ref = tag_ptr(ret_copy, true);
59917         return ret_ref;
59918 }
59919
59920 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_open_channel_v2"))) TS_MessageSendEvent_send_open_channel_v2(int8_tArray node_id, uint64_t msg) {
59921         LDKPublicKey node_id_ref;
59922         CHECK(node_id->arr_len == 33);
59923         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59924         LDKOpenChannelV2 msg_conv;
59925         msg_conv.inner = untag_ptr(msg);
59926         msg_conv.is_owned = ptr_is_owned(msg);
59927         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59928         msg_conv = OpenChannelV2_clone(&msg_conv);
59929         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59930         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
59931         uint64_t ret_ref = tag_ptr(ret_copy, true);
59932         return ret_ref;
59933 }
59934
59935 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_created"))) TS_MessageSendEvent_send_funding_created(int8_tArray node_id, uint64_t msg) {
59936         LDKPublicKey node_id_ref;
59937         CHECK(node_id->arr_len == 33);
59938         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59939         LDKFundingCreated msg_conv;
59940         msg_conv.inner = untag_ptr(msg);
59941         msg_conv.is_owned = ptr_is_owned(msg);
59942         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59943         msg_conv = FundingCreated_clone(&msg_conv);
59944         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59945         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
59946         uint64_t ret_ref = tag_ptr(ret_copy, true);
59947         return ret_ref;
59948 }
59949
59950 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_funding_signed"))) TS_MessageSendEvent_send_funding_signed(int8_tArray node_id, uint64_t msg) {
59951         LDKPublicKey node_id_ref;
59952         CHECK(node_id->arr_len == 33);
59953         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59954         LDKFundingSigned msg_conv;
59955         msg_conv.inner = untag_ptr(msg);
59956         msg_conv.is_owned = ptr_is_owned(msg);
59957         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59958         msg_conv = FundingSigned_clone(&msg_conv);
59959         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59960         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
59961         uint64_t ret_ref = tag_ptr(ret_copy, true);
59962         return ret_ref;
59963 }
59964
59965 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_input"))) TS_MessageSendEvent_send_tx_add_input(int8_tArray node_id, uint64_t msg) {
59966         LDKPublicKey node_id_ref;
59967         CHECK(node_id->arr_len == 33);
59968         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59969         LDKTxAddInput msg_conv;
59970         msg_conv.inner = untag_ptr(msg);
59971         msg_conv.is_owned = ptr_is_owned(msg);
59972         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59973         msg_conv = TxAddInput_clone(&msg_conv);
59974         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59975         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
59976         uint64_t ret_ref = tag_ptr(ret_copy, true);
59977         return ret_ref;
59978 }
59979
59980 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_add_output"))) TS_MessageSendEvent_send_tx_add_output(int8_tArray node_id, uint64_t msg) {
59981         LDKPublicKey node_id_ref;
59982         CHECK(node_id->arr_len == 33);
59983         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59984         LDKTxAddOutput msg_conv;
59985         msg_conv.inner = untag_ptr(msg);
59986         msg_conv.is_owned = ptr_is_owned(msg);
59987         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59988         msg_conv = TxAddOutput_clone(&msg_conv);
59989         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
59990         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
59991         uint64_t ret_ref = tag_ptr(ret_copy, true);
59992         return ret_ref;
59993 }
59994
59995 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_input"))) TS_MessageSendEvent_send_tx_remove_input(int8_tArray node_id, uint64_t msg) {
59996         LDKPublicKey node_id_ref;
59997         CHECK(node_id->arr_len == 33);
59998         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
59999         LDKTxRemoveInput msg_conv;
60000         msg_conv.inner = untag_ptr(msg);
60001         msg_conv.is_owned = ptr_is_owned(msg);
60002         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60003         msg_conv = TxRemoveInput_clone(&msg_conv);
60004         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60005         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
60006         uint64_t ret_ref = tag_ptr(ret_copy, true);
60007         return ret_ref;
60008 }
60009
60010 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_remove_output"))) TS_MessageSendEvent_send_tx_remove_output(int8_tArray node_id, uint64_t msg) {
60011         LDKPublicKey node_id_ref;
60012         CHECK(node_id->arr_len == 33);
60013         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60014         LDKTxRemoveOutput msg_conv;
60015         msg_conv.inner = untag_ptr(msg);
60016         msg_conv.is_owned = ptr_is_owned(msg);
60017         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60018         msg_conv = TxRemoveOutput_clone(&msg_conv);
60019         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60020         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
60021         uint64_t ret_ref = tag_ptr(ret_copy, true);
60022         return ret_ref;
60023 }
60024
60025 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_complete"))) TS_MessageSendEvent_send_tx_complete(int8_tArray node_id, uint64_t msg) {
60026         LDKPublicKey node_id_ref;
60027         CHECK(node_id->arr_len == 33);
60028         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60029         LDKTxComplete msg_conv;
60030         msg_conv.inner = untag_ptr(msg);
60031         msg_conv.is_owned = ptr_is_owned(msg);
60032         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60033         msg_conv = TxComplete_clone(&msg_conv);
60034         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60035         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
60036         uint64_t ret_ref = tag_ptr(ret_copy, true);
60037         return ret_ref;
60038 }
60039
60040 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_signatures"))) TS_MessageSendEvent_send_tx_signatures(int8_tArray node_id, uint64_t msg) {
60041         LDKPublicKey node_id_ref;
60042         CHECK(node_id->arr_len == 33);
60043         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60044         LDKTxSignatures msg_conv;
60045         msg_conv.inner = untag_ptr(msg);
60046         msg_conv.is_owned = ptr_is_owned(msg);
60047         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60048         msg_conv = TxSignatures_clone(&msg_conv);
60049         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60050         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
60051         uint64_t ret_ref = tag_ptr(ret_copy, true);
60052         return ret_ref;
60053 }
60054
60055 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_init_rbf"))) TS_MessageSendEvent_send_tx_init_rbf(int8_tArray node_id, uint64_t msg) {
60056         LDKPublicKey node_id_ref;
60057         CHECK(node_id->arr_len == 33);
60058         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60059         LDKTxInitRbf msg_conv;
60060         msg_conv.inner = untag_ptr(msg);
60061         msg_conv.is_owned = ptr_is_owned(msg);
60062         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60063         msg_conv = TxInitRbf_clone(&msg_conv);
60064         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60065         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
60066         uint64_t ret_ref = tag_ptr(ret_copy, true);
60067         return ret_ref;
60068 }
60069
60070 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_ack_rbf"))) TS_MessageSendEvent_send_tx_ack_rbf(int8_tArray node_id, uint64_t msg) {
60071         LDKPublicKey node_id_ref;
60072         CHECK(node_id->arr_len == 33);
60073         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60074         LDKTxAckRbf msg_conv;
60075         msg_conv.inner = untag_ptr(msg);
60076         msg_conv.is_owned = ptr_is_owned(msg);
60077         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60078         msg_conv = TxAckRbf_clone(&msg_conv);
60079         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60080         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
60081         uint64_t ret_ref = tag_ptr(ret_copy, true);
60082         return ret_ref;
60083 }
60084
60085 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_tx_abort"))) TS_MessageSendEvent_send_tx_abort(int8_tArray node_id, uint64_t msg) {
60086         LDKPublicKey node_id_ref;
60087         CHECK(node_id->arr_len == 33);
60088         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60089         LDKTxAddInput msg_conv;
60090         msg_conv.inner = untag_ptr(msg);
60091         msg_conv.is_owned = ptr_is_owned(msg);
60092         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60093         msg_conv = TxAddInput_clone(&msg_conv);
60094         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60095         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
60096         uint64_t ret_ref = tag_ptr(ret_copy, true);
60097         return ret_ref;
60098 }
60099
60100 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_ready"))) TS_MessageSendEvent_send_channel_ready(int8_tArray node_id, uint64_t msg) {
60101         LDKPublicKey node_id_ref;
60102         CHECK(node_id->arr_len == 33);
60103         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60104         LDKChannelReady msg_conv;
60105         msg_conv.inner = untag_ptr(msg);
60106         msg_conv.is_owned = ptr_is_owned(msg);
60107         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60108         msg_conv = ChannelReady_clone(&msg_conv);
60109         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60110         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
60111         uint64_t ret_ref = tag_ptr(ret_copy, true);
60112         return ret_ref;
60113 }
60114
60115 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_announcement_signatures"))) TS_MessageSendEvent_send_announcement_signatures(int8_tArray node_id, uint64_t msg) {
60116         LDKPublicKey node_id_ref;
60117         CHECK(node_id->arr_len == 33);
60118         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60119         LDKAnnouncementSignatures msg_conv;
60120         msg_conv.inner = untag_ptr(msg);
60121         msg_conv.is_owned = ptr_is_owned(msg);
60122         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60123         msg_conv = AnnouncementSignatures_clone(&msg_conv);
60124         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60125         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
60126         uint64_t ret_ref = tag_ptr(ret_copy, true);
60127         return ret_ref;
60128 }
60129
60130 uint64_t  __attribute__((export_name("TS_MessageSendEvent_update_htlcs"))) TS_MessageSendEvent_update_htlcs(int8_tArray node_id, uint64_t updates) {
60131         LDKPublicKey node_id_ref;
60132         CHECK(node_id->arr_len == 33);
60133         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60134         LDKCommitmentUpdate updates_conv;
60135         updates_conv.inner = untag_ptr(updates);
60136         updates_conv.is_owned = ptr_is_owned(updates);
60137         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
60138         updates_conv = CommitmentUpdate_clone(&updates_conv);
60139         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60140         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
60141         uint64_t ret_ref = tag_ptr(ret_copy, true);
60142         return ret_ref;
60143 }
60144
60145 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_revoke_and_ack"))) TS_MessageSendEvent_send_revoke_and_ack(int8_tArray node_id, uint64_t msg) {
60146         LDKPublicKey node_id_ref;
60147         CHECK(node_id->arr_len == 33);
60148         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60149         LDKRevokeAndACK msg_conv;
60150         msg_conv.inner = untag_ptr(msg);
60151         msg_conv.is_owned = ptr_is_owned(msg);
60152         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60153         msg_conv = RevokeAndACK_clone(&msg_conv);
60154         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60155         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
60156         uint64_t ret_ref = tag_ptr(ret_copy, true);
60157         return ret_ref;
60158 }
60159
60160 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_closing_signed"))) TS_MessageSendEvent_send_closing_signed(int8_tArray node_id, uint64_t msg) {
60161         LDKPublicKey node_id_ref;
60162         CHECK(node_id->arr_len == 33);
60163         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60164         LDKClosingSigned msg_conv;
60165         msg_conv.inner = untag_ptr(msg);
60166         msg_conv.is_owned = ptr_is_owned(msg);
60167         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60168         msg_conv = ClosingSigned_clone(&msg_conv);
60169         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60170         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
60171         uint64_t ret_ref = tag_ptr(ret_copy, true);
60172         return ret_ref;
60173 }
60174
60175 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_shutdown"))) TS_MessageSendEvent_send_shutdown(int8_tArray node_id, uint64_t msg) {
60176         LDKPublicKey node_id_ref;
60177         CHECK(node_id->arr_len == 33);
60178         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60179         LDKShutdown msg_conv;
60180         msg_conv.inner = untag_ptr(msg);
60181         msg_conv.is_owned = ptr_is_owned(msg);
60182         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60183         msg_conv = Shutdown_clone(&msg_conv);
60184         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60185         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
60186         uint64_t ret_ref = tag_ptr(ret_copy, true);
60187         return ret_ref;
60188 }
60189
60190 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_reestablish"))) TS_MessageSendEvent_send_channel_reestablish(int8_tArray node_id, uint64_t msg) {
60191         LDKPublicKey node_id_ref;
60192         CHECK(node_id->arr_len == 33);
60193         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60194         LDKChannelReestablish msg_conv;
60195         msg_conv.inner = untag_ptr(msg);
60196         msg_conv.is_owned = ptr_is_owned(msg);
60197         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60198         msg_conv = ChannelReestablish_clone(&msg_conv);
60199         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60200         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
60201         uint64_t ret_ref = tag_ptr(ret_copy, true);
60202         return ret_ref;
60203 }
60204
60205 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) {
60206         LDKPublicKey node_id_ref;
60207         CHECK(node_id->arr_len == 33);
60208         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60209         LDKChannelAnnouncement msg_conv;
60210         msg_conv.inner = untag_ptr(msg);
60211         msg_conv.is_owned = ptr_is_owned(msg);
60212         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60213         msg_conv = ChannelAnnouncement_clone(&msg_conv);
60214         LDKChannelUpdate update_msg_conv;
60215         update_msg_conv.inner = untag_ptr(update_msg);
60216         update_msg_conv.is_owned = ptr_is_owned(update_msg);
60217         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
60218         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
60219         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60220         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
60221         uint64_t ret_ref = tag_ptr(ret_copy, true);
60222         return ret_ref;
60223 }
60224
60225 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_announcement"))) TS_MessageSendEvent_broadcast_channel_announcement(uint64_t msg, uint64_t update_msg) {
60226         LDKChannelAnnouncement msg_conv;
60227         msg_conv.inner = untag_ptr(msg);
60228         msg_conv.is_owned = ptr_is_owned(msg);
60229         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60230         msg_conv = ChannelAnnouncement_clone(&msg_conv);
60231         LDKChannelUpdate update_msg_conv;
60232         update_msg_conv.inner = untag_ptr(update_msg);
60233         update_msg_conv.is_owned = ptr_is_owned(update_msg);
60234         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
60235         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
60236         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60237         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
60238         uint64_t ret_ref = tag_ptr(ret_copy, true);
60239         return ret_ref;
60240 }
60241
60242 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_update"))) TS_MessageSendEvent_broadcast_channel_update(uint64_t msg) {
60243         LDKChannelUpdate msg_conv;
60244         msg_conv.inner = untag_ptr(msg);
60245         msg_conv.is_owned = ptr_is_owned(msg);
60246         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60247         msg_conv = ChannelUpdate_clone(&msg_conv);
60248         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60249         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
60250         uint64_t ret_ref = tag_ptr(ret_copy, true);
60251         return ret_ref;
60252 }
60253
60254 uint64_t  __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) {
60255         LDKNodeAnnouncement msg_conv;
60256         msg_conv.inner = untag_ptr(msg);
60257         msg_conv.is_owned = ptr_is_owned(msg);
60258         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60259         msg_conv = NodeAnnouncement_clone(&msg_conv);
60260         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60261         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
60262         uint64_t ret_ref = tag_ptr(ret_copy, true);
60263         return ret_ref;
60264 }
60265
60266 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) {
60267         LDKPublicKey node_id_ref;
60268         CHECK(node_id->arr_len == 33);
60269         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60270         LDKChannelUpdate msg_conv;
60271         msg_conv.inner = untag_ptr(msg);
60272         msg_conv.is_owned = ptr_is_owned(msg);
60273         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60274         msg_conv = ChannelUpdate_clone(&msg_conv);
60275         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60276         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
60277         uint64_t ret_ref = tag_ptr(ret_copy, true);
60278         return ret_ref;
60279 }
60280
60281 uint64_t  __attribute__((export_name("TS_MessageSendEvent_handle_error"))) TS_MessageSendEvent_handle_error(int8_tArray node_id, uint64_t action) {
60282         LDKPublicKey node_id_ref;
60283         CHECK(node_id->arr_len == 33);
60284         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60285         void* action_ptr = untag_ptr(action);
60286         CHECK_ACCESS(action_ptr);
60287         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
60288         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
60289         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60290         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
60291         uint64_t ret_ref = tag_ptr(ret_copy, true);
60292         return ret_ref;
60293 }
60294
60295 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_channel_range_query"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint64_t msg) {
60296         LDKPublicKey node_id_ref;
60297         CHECK(node_id->arr_len == 33);
60298         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60299         LDKQueryChannelRange msg_conv;
60300         msg_conv.inner = untag_ptr(msg);
60301         msg_conv.is_owned = ptr_is_owned(msg);
60302         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60303         msg_conv = QueryChannelRange_clone(&msg_conv);
60304         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60305         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
60306         uint64_t ret_ref = tag_ptr(ret_copy, true);
60307         return ret_ref;
60308 }
60309
60310 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_short_ids_query"))) TS_MessageSendEvent_send_short_ids_query(int8_tArray node_id, uint64_t msg) {
60311         LDKPublicKey node_id_ref;
60312         CHECK(node_id->arr_len == 33);
60313         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60314         LDKQueryShortChannelIds msg_conv;
60315         msg_conv.inner = untag_ptr(msg);
60316         msg_conv.is_owned = ptr_is_owned(msg);
60317         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60318         msg_conv = QueryShortChannelIds_clone(&msg_conv);
60319         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60320         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
60321         uint64_t ret_ref = tag_ptr(ret_copy, true);
60322         return ret_ref;
60323 }
60324
60325 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_reply_channel_range"))) TS_MessageSendEvent_send_reply_channel_range(int8_tArray node_id, uint64_t msg) {
60326         LDKPublicKey node_id_ref;
60327         CHECK(node_id->arr_len == 33);
60328         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60329         LDKReplyChannelRange msg_conv;
60330         msg_conv.inner = untag_ptr(msg);
60331         msg_conv.is_owned = ptr_is_owned(msg);
60332         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60333         msg_conv = ReplyChannelRange_clone(&msg_conv);
60334         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60335         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
60336         uint64_t ret_ref = tag_ptr(ret_copy, true);
60337         return ret_ref;
60338 }
60339
60340 uint64_t  __attribute__((export_name("TS_MessageSendEvent_send_gossip_timestamp_filter"))) TS_MessageSendEvent_send_gossip_timestamp_filter(int8_tArray node_id, uint64_t msg) {
60341         LDKPublicKey node_id_ref;
60342         CHECK(node_id->arr_len == 33);
60343         memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
60344         LDKGossipTimestampFilter msg_conv;
60345         msg_conv.inner = untag_ptr(msg);
60346         msg_conv.is_owned = ptr_is_owned(msg);
60347         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
60348         msg_conv = GossipTimestampFilter_clone(&msg_conv);
60349         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
60350         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
60351         uint64_t ret_ref = tag_ptr(ret_copy, true);
60352         return ret_ref;
60353 }
60354
60355 void  __attribute__((export_name("TS_MessageSendEventsProvider_free"))) TS_MessageSendEventsProvider_free(uint64_t this_ptr) {
60356         if (!ptr_is_owned(this_ptr)) return;
60357         void* this_ptr_ptr = untag_ptr(this_ptr);
60358         CHECK_ACCESS(this_ptr_ptr);
60359         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
60360         FREE(untag_ptr(this_ptr));
60361         MessageSendEventsProvider_free(this_ptr_conv);
60362 }
60363
60364 void  __attribute__((export_name("TS_OnionMessageProvider_free"))) TS_OnionMessageProvider_free(uint64_t this_ptr) {
60365         if (!ptr_is_owned(this_ptr)) return;
60366         void* this_ptr_ptr = untag_ptr(this_ptr);
60367         CHECK_ACCESS(this_ptr_ptr);
60368         LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr);
60369         FREE(untag_ptr(this_ptr));
60370         OnionMessageProvider_free(this_ptr_conv);
60371 }
60372
60373 void  __attribute__((export_name("TS_EventsProvider_free"))) TS_EventsProvider_free(uint64_t this_ptr) {
60374         if (!ptr_is_owned(this_ptr)) return;
60375         void* this_ptr_ptr = untag_ptr(this_ptr);
60376         CHECK_ACCESS(this_ptr_ptr);
60377         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
60378         FREE(untag_ptr(this_ptr));
60379         EventsProvider_free(this_ptr_conv);
60380 }
60381
60382 void  __attribute__((export_name("TS_EventHandler_free"))) TS_EventHandler_free(uint64_t this_ptr) {
60383         if (!ptr_is_owned(this_ptr)) return;
60384         void* this_ptr_ptr = untag_ptr(this_ptr);
60385         CHECK_ACCESS(this_ptr_ptr);
60386         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
60387         FREE(untag_ptr(this_ptr));
60388         EventHandler_free(this_ptr_conv);
60389 }
60390
60391 void  __attribute__((export_name("TS_ChannelDerivationParameters_free"))) TS_ChannelDerivationParameters_free(uint64_t this_obj) {
60392         LDKChannelDerivationParameters this_obj_conv;
60393         this_obj_conv.inner = untag_ptr(this_obj);
60394         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60396         ChannelDerivationParameters_free(this_obj_conv);
60397 }
60398
60399 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_value_satoshis"))) TS_ChannelDerivationParameters_get_value_satoshis(uint64_t this_ptr) {
60400         LDKChannelDerivationParameters this_ptr_conv;
60401         this_ptr_conv.inner = untag_ptr(this_ptr);
60402         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60404         this_ptr_conv.is_owned = false;
60405         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
60406         return ret_conv;
60407 }
60408
60409 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_value_satoshis"))) TS_ChannelDerivationParameters_set_value_satoshis(uint64_t this_ptr, int64_t val) {
60410         LDKChannelDerivationParameters this_ptr_conv;
60411         this_ptr_conv.inner = untag_ptr(this_ptr);
60412         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60414         this_ptr_conv.is_owned = false;
60415         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
60416 }
60417
60418 int8_tArray  __attribute__((export_name("TS_ChannelDerivationParameters_get_keys_id"))) TS_ChannelDerivationParameters_get_keys_id(uint64_t this_ptr) {
60419         LDKChannelDerivationParameters this_ptr_conv;
60420         this_ptr_conv.inner = untag_ptr(this_ptr);
60421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60423         this_ptr_conv.is_owned = false;
60424         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
60425         memcpy(ret_arr->elems, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv), 32);
60426         return ret_arr;
60427 }
60428
60429 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_keys_id"))) TS_ChannelDerivationParameters_set_keys_id(uint64_t this_ptr, int8_tArray val) {
60430         LDKChannelDerivationParameters this_ptr_conv;
60431         this_ptr_conv.inner = untag_ptr(this_ptr);
60432         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60433         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60434         this_ptr_conv.is_owned = false;
60435         LDKThirtyTwoBytes val_ref;
60436         CHECK(val->arr_len == 32);
60437         memcpy(val_ref.data, val->elems, 32); FREE(val);
60438         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
60439 }
60440
60441 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_get_transaction_parameters"))) TS_ChannelDerivationParameters_get_transaction_parameters(uint64_t this_ptr) {
60442         LDKChannelDerivationParameters this_ptr_conv;
60443         this_ptr_conv.inner = untag_ptr(this_ptr);
60444         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60446         this_ptr_conv.is_owned = false;
60447         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
60448         uint64_t ret_ref = 0;
60449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60451         return ret_ref;
60452 }
60453
60454 void  __attribute__((export_name("TS_ChannelDerivationParameters_set_transaction_parameters"))) TS_ChannelDerivationParameters_set_transaction_parameters(uint64_t this_ptr, uint64_t val) {
60455         LDKChannelDerivationParameters this_ptr_conv;
60456         this_ptr_conv.inner = untag_ptr(this_ptr);
60457         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60459         this_ptr_conv.is_owned = false;
60460         LDKChannelTransactionParameters val_conv;
60461         val_conv.inner = untag_ptr(val);
60462         val_conv.is_owned = ptr_is_owned(val);
60463         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60464         val_conv = ChannelTransactionParameters_clone(&val_conv);
60465         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
60466 }
60467
60468 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) {
60469         LDKThirtyTwoBytes keys_id_arg_ref;
60470         CHECK(keys_id_arg->arr_len == 32);
60471         memcpy(keys_id_arg_ref.data, keys_id_arg->elems, 32); FREE(keys_id_arg);
60472         LDKChannelTransactionParameters transaction_parameters_arg_conv;
60473         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
60474         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
60475         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
60476         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
60477         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
60478         uint64_t ret_ref = 0;
60479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60481         return ret_ref;
60482 }
60483
60484 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
60485         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
60486         uint64_t ret_ref = 0;
60487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60489         return ret_ref;
60490 }
60491 int64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone_ptr"))) TS_ChannelDerivationParameters_clone_ptr(uint64_t arg) {
60492         LDKChannelDerivationParameters arg_conv;
60493         arg_conv.inner = untag_ptr(arg);
60494         arg_conv.is_owned = ptr_is_owned(arg);
60495         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60496         arg_conv.is_owned = false;
60497         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
60498         return ret_conv;
60499 }
60500
60501 uint64_t  __attribute__((export_name("TS_ChannelDerivationParameters_clone"))) TS_ChannelDerivationParameters_clone(uint64_t orig) {
60502         LDKChannelDerivationParameters orig_conv;
60503         orig_conv.inner = untag_ptr(orig);
60504         orig_conv.is_owned = ptr_is_owned(orig);
60505         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60506         orig_conv.is_owned = false;
60507         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
60508         uint64_t ret_ref = 0;
60509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60511         return ret_ref;
60512 }
60513
60514 jboolean  __attribute__((export_name("TS_ChannelDerivationParameters_eq"))) TS_ChannelDerivationParameters_eq(uint64_t a, uint64_t b) {
60515         LDKChannelDerivationParameters a_conv;
60516         a_conv.inner = untag_ptr(a);
60517         a_conv.is_owned = ptr_is_owned(a);
60518         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60519         a_conv.is_owned = false;
60520         LDKChannelDerivationParameters b_conv;
60521         b_conv.inner = untag_ptr(b);
60522         b_conv.is_owned = ptr_is_owned(b);
60523         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60524         b_conv.is_owned = false;
60525         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
60526         return ret_conv;
60527 }
60528
60529 void  __attribute__((export_name("TS_AnchorDescriptor_free"))) TS_AnchorDescriptor_free(uint64_t this_obj) {
60530         LDKAnchorDescriptor this_obj_conv;
60531         this_obj_conv.inner = untag_ptr(this_obj);
60532         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60534         AnchorDescriptor_free(this_obj_conv);
60535 }
60536
60537 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_channel_derivation_parameters"))) TS_AnchorDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
60538         LDKAnchorDescriptor this_ptr_conv;
60539         this_ptr_conv.inner = untag_ptr(this_ptr);
60540         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60542         this_ptr_conv.is_owned = false;
60543         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
60544         uint64_t ret_ref = 0;
60545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60547         return ret_ref;
60548 }
60549
60550 void  __attribute__((export_name("TS_AnchorDescriptor_set_channel_derivation_parameters"))) TS_AnchorDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
60551         LDKAnchorDescriptor this_ptr_conv;
60552         this_ptr_conv.inner = untag_ptr(this_ptr);
60553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60555         this_ptr_conv.is_owned = false;
60556         LDKChannelDerivationParameters val_conv;
60557         val_conv.inner = untag_ptr(val);
60558         val_conv.is_owned = ptr_is_owned(val);
60559         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60560         val_conv = ChannelDerivationParameters_clone(&val_conv);
60561         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
60562 }
60563
60564 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_get_outpoint"))) TS_AnchorDescriptor_get_outpoint(uint64_t this_ptr) {
60565         LDKAnchorDescriptor 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         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
60571         uint64_t ret_ref = 0;
60572         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60573         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60574         return ret_ref;
60575 }
60576
60577 void  __attribute__((export_name("TS_AnchorDescriptor_set_outpoint"))) TS_AnchorDescriptor_set_outpoint(uint64_t this_ptr, uint64_t val) {
60578         LDKAnchorDescriptor this_ptr_conv;
60579         this_ptr_conv.inner = untag_ptr(this_ptr);
60580         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60582         this_ptr_conv.is_owned = false;
60583         LDKOutPoint val_conv;
60584         val_conv.inner = untag_ptr(val);
60585         val_conv.is_owned = ptr_is_owned(val);
60586         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60587         val_conv = OutPoint_clone(&val_conv);
60588         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
60589 }
60590
60591 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_new"))) TS_AnchorDescriptor_new(uint64_t channel_derivation_parameters_arg, uint64_t outpoint_arg) {
60592         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
60593         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
60594         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
60595         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
60596         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
60597         LDKOutPoint outpoint_arg_conv;
60598         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
60599         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
60600         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
60601         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
60602         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
60603         uint64_t ret_ref = 0;
60604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60606         return ret_ref;
60607 }
60608
60609 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
60610         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
60611         uint64_t ret_ref = 0;
60612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60614         return ret_ref;
60615 }
60616 int64_t  __attribute__((export_name("TS_AnchorDescriptor_clone_ptr"))) TS_AnchorDescriptor_clone_ptr(uint64_t arg) {
60617         LDKAnchorDescriptor arg_conv;
60618         arg_conv.inner = untag_ptr(arg);
60619         arg_conv.is_owned = ptr_is_owned(arg);
60620         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60621         arg_conv.is_owned = false;
60622         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
60623         return ret_conv;
60624 }
60625
60626 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_clone"))) TS_AnchorDescriptor_clone(uint64_t orig) {
60627         LDKAnchorDescriptor orig_conv;
60628         orig_conv.inner = untag_ptr(orig);
60629         orig_conv.is_owned = ptr_is_owned(orig);
60630         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60631         orig_conv.is_owned = false;
60632         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
60633         uint64_t ret_ref = 0;
60634         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60635         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60636         return ret_ref;
60637 }
60638
60639 jboolean  __attribute__((export_name("TS_AnchorDescriptor_eq"))) TS_AnchorDescriptor_eq(uint64_t a, uint64_t b) {
60640         LDKAnchorDescriptor a_conv;
60641         a_conv.inner = untag_ptr(a);
60642         a_conv.is_owned = ptr_is_owned(a);
60643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60644         a_conv.is_owned = false;
60645         LDKAnchorDescriptor b_conv;
60646         b_conv.inner = untag_ptr(b);
60647         b_conv.is_owned = ptr_is_owned(b);
60648         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60649         b_conv.is_owned = false;
60650         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
60651         return ret_conv;
60652 }
60653
60654 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_previous_utxo"))) TS_AnchorDescriptor_previous_utxo(uint64_t this_arg) {
60655         LDKAnchorDescriptor this_arg_conv;
60656         this_arg_conv.inner = untag_ptr(this_arg);
60657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60659         this_arg_conv.is_owned = false;
60660         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
60661         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
60662         return tag_ptr(ret_ref, true);
60663 }
60664
60665 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_unsigned_tx_input"))) TS_AnchorDescriptor_unsigned_tx_input(uint64_t this_arg) {
60666         LDKAnchorDescriptor this_arg_conv;
60667         this_arg_conv.inner = untag_ptr(this_arg);
60668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60670         this_arg_conv.is_owned = false;
60671         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
60672         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
60673         return tag_ptr(ret_ref, true);
60674 }
60675
60676 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_witness_script"))) TS_AnchorDescriptor_witness_script(uint64_t this_arg) {
60677         LDKAnchorDescriptor this_arg_conv;
60678         this_arg_conv.inner = untag_ptr(this_arg);
60679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60681         this_arg_conv.is_owned = false;
60682         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
60683         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60684         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60685         CVec_u8Z_free(ret_var);
60686         return ret_arr;
60687 }
60688
60689 int8_tArray  __attribute__((export_name("TS_AnchorDescriptor_tx_input_witness"))) TS_AnchorDescriptor_tx_input_witness(uint64_t this_arg, int8_tArray signature) {
60690         LDKAnchorDescriptor 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         LDKSignature signature_ref;
60696         CHECK(signature->arr_len == 64);
60697         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
60698         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
60699         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60700         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60701         Witness_free(ret_var);
60702         return ret_arr;
60703 }
60704
60705 uint64_t  __attribute__((export_name("TS_AnchorDescriptor_derive_channel_signer"))) TS_AnchorDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
60706         LDKAnchorDescriptor this_arg_conv;
60707         this_arg_conv.inner = untag_ptr(this_arg);
60708         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60710         this_arg_conv.is_owned = false;
60711         void* signer_provider_ptr = untag_ptr(signer_provider);
60712         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
60713         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
60714         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
60715         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
60716         return tag_ptr(ret_ret, true);
60717 }
60718
60719 void  __attribute__((export_name("TS_HTLCDescriptor_free"))) TS_HTLCDescriptor_free(uint64_t this_obj) {
60720         LDKHTLCDescriptor this_obj_conv;
60721         this_obj_conv.inner = untag_ptr(this_obj);
60722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60724         HTLCDescriptor_free(this_obj_conv);
60725 }
60726
60727 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_channel_derivation_parameters"))) TS_HTLCDescriptor_get_channel_derivation_parameters(uint64_t this_ptr) {
60728         LDKHTLCDescriptor this_ptr_conv;
60729         this_ptr_conv.inner = untag_ptr(this_ptr);
60730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60732         this_ptr_conv.is_owned = false;
60733         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
60734         uint64_t ret_ref = 0;
60735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60737         return ret_ref;
60738 }
60739
60740 void  __attribute__((export_name("TS_HTLCDescriptor_set_channel_derivation_parameters"))) TS_HTLCDescriptor_set_channel_derivation_parameters(uint64_t this_ptr, uint64_t val) {
60741         LDKHTLCDescriptor this_ptr_conv;
60742         this_ptr_conv.inner = untag_ptr(this_ptr);
60743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60745         this_ptr_conv.is_owned = false;
60746         LDKChannelDerivationParameters val_conv;
60747         val_conv.inner = untag_ptr(val);
60748         val_conv.is_owned = ptr_is_owned(val);
60749         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60750         val_conv = ChannelDerivationParameters_clone(&val_conv);
60751         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
60752 }
60753
60754 int64_t  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_number"))) TS_HTLCDescriptor_get_per_commitment_number(uint64_t this_ptr) {
60755         LDKHTLCDescriptor this_ptr_conv;
60756         this_ptr_conv.inner = untag_ptr(this_ptr);
60757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60759         this_ptr_conv.is_owned = false;
60760         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
60761         return ret_conv;
60762 }
60763
60764 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_number"))) TS_HTLCDescriptor_set_per_commitment_number(uint64_t this_ptr, int64_t val) {
60765         LDKHTLCDescriptor this_ptr_conv;
60766         this_ptr_conv.inner = untag_ptr(this_ptr);
60767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60769         this_ptr_conv.is_owned = false;
60770         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
60771 }
60772
60773 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_per_commitment_point"))) TS_HTLCDescriptor_get_per_commitment_point(uint64_t this_ptr) {
60774         LDKHTLCDescriptor this_ptr_conv;
60775         this_ptr_conv.inner = untag_ptr(this_ptr);
60776         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60778         this_ptr_conv.is_owned = false;
60779         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
60780         memcpy(ret_arr->elems, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33);
60781         return ret_arr;
60782 }
60783
60784 void  __attribute__((export_name("TS_HTLCDescriptor_set_per_commitment_point"))) TS_HTLCDescriptor_set_per_commitment_point(uint64_t this_ptr, int8_tArray val) {
60785         LDKHTLCDescriptor this_ptr_conv;
60786         this_ptr_conv.inner = untag_ptr(this_ptr);
60787         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60789         this_ptr_conv.is_owned = false;
60790         LDKPublicKey val_ref;
60791         CHECK(val->arr_len == 33);
60792         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
60793         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
60794 }
60795
60796 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_htlc"))) TS_HTLCDescriptor_get_htlc(uint64_t this_ptr) {
60797         LDKHTLCDescriptor this_ptr_conv;
60798         this_ptr_conv.inner = untag_ptr(this_ptr);
60799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60801         this_ptr_conv.is_owned = false;
60802         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
60803         uint64_t ret_ref = 0;
60804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60806         return ret_ref;
60807 }
60808
60809 void  __attribute__((export_name("TS_HTLCDescriptor_set_htlc"))) TS_HTLCDescriptor_set_htlc(uint64_t this_ptr, uint64_t val) {
60810         LDKHTLCDescriptor 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         LDKHTLCOutputInCommitment val_conv;
60816         val_conv.inner = untag_ptr(val);
60817         val_conv.is_owned = ptr_is_owned(val);
60818         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
60819         val_conv = HTLCOutputInCommitment_clone(&val_conv);
60820         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
60821 }
60822
60823 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_get_preimage"))) TS_HTLCDescriptor_get_preimage(uint64_t this_ptr) {
60824         LDKHTLCDescriptor this_ptr_conv;
60825         this_ptr_conv.inner = untag_ptr(this_ptr);
60826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60828         this_ptr_conv.is_owned = false;
60829         LDKCOption_PaymentPreimageZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentPreimageZ), "LDKCOption_PaymentPreimageZ");
60830         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
60831         uint64_t ret_ref = tag_ptr(ret_copy, true);
60832         return ret_ref;
60833 }
60834
60835 void  __attribute__((export_name("TS_HTLCDescriptor_set_preimage"))) TS_HTLCDescriptor_set_preimage(uint64_t this_ptr, uint64_t val) {
60836         LDKHTLCDescriptor this_ptr_conv;
60837         this_ptr_conv.inner = untag_ptr(this_ptr);
60838         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60840         this_ptr_conv.is_owned = false;
60841         void* val_ptr = untag_ptr(val);
60842         CHECK_ACCESS(val_ptr);
60843         LDKCOption_PaymentPreimageZ val_conv = *(LDKCOption_PaymentPreimageZ*)(val_ptr);
60844         val_conv = COption_PaymentPreimageZ_clone((LDKCOption_PaymentPreimageZ*)untag_ptr(val));
60845         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
60846 }
60847
60848 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_get_counterparty_sig"))) TS_HTLCDescriptor_get_counterparty_sig(uint64_t this_ptr) {
60849         LDKHTLCDescriptor this_ptr_conv;
60850         this_ptr_conv.inner = untag_ptr(this_ptr);
60851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60853         this_ptr_conv.is_owned = false;
60854         int8_tArray ret_arr = init_int8_tArray(64, __LINE__);
60855         memcpy(ret_arr->elems, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form, 64);
60856         return ret_arr;
60857 }
60858
60859 void  __attribute__((export_name("TS_HTLCDescriptor_set_counterparty_sig"))) TS_HTLCDescriptor_set_counterparty_sig(uint64_t this_ptr, int8_tArray val) {
60860         LDKHTLCDescriptor 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         LDKSignature val_ref;
60866         CHECK(val->arr_len == 64);
60867         memcpy(val_ref.compact_form, val->elems, 64); FREE(val);
60868         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
60869 }
60870
60871 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
60872         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
60873         uint64_t ret_ref = 0;
60874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60876         return ret_ref;
60877 }
60878 int64_t  __attribute__((export_name("TS_HTLCDescriptor_clone_ptr"))) TS_HTLCDescriptor_clone_ptr(uint64_t arg) {
60879         LDKHTLCDescriptor arg_conv;
60880         arg_conv.inner = untag_ptr(arg);
60881         arg_conv.is_owned = ptr_is_owned(arg);
60882         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60883         arg_conv.is_owned = false;
60884         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
60885         return ret_conv;
60886 }
60887
60888 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_clone"))) TS_HTLCDescriptor_clone(uint64_t orig) {
60889         LDKHTLCDescriptor orig_conv;
60890         orig_conv.inner = untag_ptr(orig);
60891         orig_conv.is_owned = ptr_is_owned(orig);
60892         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60893         orig_conv.is_owned = false;
60894         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
60895         uint64_t ret_ref = 0;
60896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60898         return ret_ref;
60899 }
60900
60901 jboolean  __attribute__((export_name("TS_HTLCDescriptor_eq"))) TS_HTLCDescriptor_eq(uint64_t a, uint64_t b) {
60902         LDKHTLCDescriptor a_conv;
60903         a_conv.inner = untag_ptr(a);
60904         a_conv.is_owned = ptr_is_owned(a);
60905         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60906         a_conv.is_owned = false;
60907         LDKHTLCDescriptor b_conv;
60908         b_conv.inner = untag_ptr(b);
60909         b_conv.is_owned = ptr_is_owned(b);
60910         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60911         b_conv.is_owned = false;
60912         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
60913         return ret_conv;
60914 }
60915
60916 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_outpoint"))) TS_HTLCDescriptor_outpoint(uint64_t this_arg) {
60917         LDKHTLCDescriptor this_arg_conv;
60918         this_arg_conv.inner = untag_ptr(this_arg);
60919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60921         this_arg_conv.is_owned = false;
60922         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
60923         uint64_t ret_ref = 0;
60924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60926         return ret_ref;
60927 }
60928
60929 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_previous_utxo"))) TS_HTLCDescriptor_previous_utxo(uint64_t this_arg) {
60930         LDKHTLCDescriptor this_arg_conv;
60931         this_arg_conv.inner = untag_ptr(this_arg);
60932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60934         this_arg_conv.is_owned = false;
60935         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
60936         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
60937         return tag_ptr(ret_ref, true);
60938 }
60939
60940 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_unsigned_tx_input"))) TS_HTLCDescriptor_unsigned_tx_input(uint64_t this_arg) {
60941         LDKHTLCDescriptor this_arg_conv;
60942         this_arg_conv.inner = untag_ptr(this_arg);
60943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60945         this_arg_conv.is_owned = false;
60946         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
60947         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
60948         return tag_ptr(ret_ref, true);
60949 }
60950
60951 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_tx_output"))) TS_HTLCDescriptor_tx_output(uint64_t this_arg) {
60952         LDKHTLCDescriptor this_arg_conv;
60953         this_arg_conv.inner = untag_ptr(this_arg);
60954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60956         this_arg_conv.is_owned = false;
60957         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
60958         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
60959         return tag_ptr(ret_ref, true);
60960 }
60961
60962 int8_tArray  __attribute__((export_name("TS_HTLCDescriptor_witness_script"))) TS_HTLCDescriptor_witness_script(uint64_t this_arg) {
60963         LDKHTLCDescriptor this_arg_conv;
60964         this_arg_conv.inner = untag_ptr(this_arg);
60965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60967         this_arg_conv.is_owned = false;
60968         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
60969         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60970         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60971         CVec_u8Z_free(ret_var);
60972         return ret_arr;
60973 }
60974
60975 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) {
60976         LDKHTLCDescriptor this_arg_conv;
60977         this_arg_conv.inner = untag_ptr(this_arg);
60978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
60980         this_arg_conv.is_owned = false;
60981         LDKSignature signature_ref;
60982         CHECK(signature->arr_len == 64);
60983         memcpy(signature_ref.compact_form, signature->elems, 64); FREE(signature);
60984         LDKu8slice witness_script_ref;
60985         witness_script_ref.datalen = witness_script->arr_len;
60986         witness_script_ref.data = witness_script->elems;
60987         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
60988         int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
60989         memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
60990         Witness_free(ret_var);
60991         FREE(witness_script);
60992         return ret_arr;
60993 }
60994
60995 uint64_t  __attribute__((export_name("TS_HTLCDescriptor_derive_channel_signer"))) TS_HTLCDescriptor_derive_channel_signer(uint64_t this_arg, uint64_t signer_provider) {
60996         LDKHTLCDescriptor this_arg_conv;
60997         this_arg_conv.inner = untag_ptr(this_arg);
60998         this_arg_conv.is_owned = ptr_is_owned(this_arg);
60999         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61000         this_arg_conv.is_owned = false;
61001         void* signer_provider_ptr = untag_ptr(signer_provider);
61002         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
61003         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
61004         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
61005         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
61006         return tag_ptr(ret_ret, true);
61007 }
61008
61009 void  __attribute__((export_name("TS_BumpTransactionEvent_free"))) TS_BumpTransactionEvent_free(uint64_t this_ptr) {
61010         if (!ptr_is_owned(this_ptr)) return;
61011         void* this_ptr_ptr = untag_ptr(this_ptr);
61012         CHECK_ACCESS(this_ptr_ptr);
61013         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
61014         FREE(untag_ptr(this_ptr));
61015         BumpTransactionEvent_free(this_ptr_conv);
61016 }
61017
61018 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
61019         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
61020         *ret_copy = BumpTransactionEvent_clone(arg);
61021         uint64_t ret_ref = tag_ptr(ret_copy, true);
61022         return ret_ref;
61023 }
61024 int64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone_ptr"))) TS_BumpTransactionEvent_clone_ptr(uint64_t arg) {
61025         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
61026         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
61027         return ret_conv;
61028 }
61029
61030 uint64_t  __attribute__((export_name("TS_BumpTransactionEvent_clone"))) TS_BumpTransactionEvent_clone(uint64_t orig) {
61031         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
61032         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
61033         *ret_copy = BumpTransactionEvent_clone(orig_conv);
61034         uint64_t ret_ref = tag_ptr(ret_copy, true);
61035         return ret_ref;
61036 }
61037
61038 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) {
61039         LDKThirtyTwoBytes claim_id_ref;
61040         CHECK(claim_id->arr_len == 32);
61041         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
61042         LDKTransaction commitment_tx_ref;
61043         commitment_tx_ref.datalen = commitment_tx->arr_len;
61044         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
61045         memcpy(commitment_tx_ref.data, commitment_tx->elems, commitment_tx_ref.datalen); FREE(commitment_tx);
61046         commitment_tx_ref.data_is_owned = true;
61047         LDKAnchorDescriptor anchor_descriptor_conv;
61048         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
61049         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
61050         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
61051         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
61052         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
61053         pending_htlcs_constr.datalen = pending_htlcs->arr_len;
61054         if (pending_htlcs_constr.datalen > 0)
61055                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
61056         else
61057                 pending_htlcs_constr.data = NULL;
61058         uint64_t* pending_htlcs_vals = pending_htlcs->elems;
61059         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
61060                 uint64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
61061                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
61062                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
61063                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
61064                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
61065                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
61066                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
61067         }
61068         FREE(pending_htlcs);
61069         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
61070         *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);
61071         uint64_t ret_ref = tag_ptr(ret_copy, true);
61072         return ret_ref;
61073 }
61074
61075 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) {
61076         LDKThirtyTwoBytes claim_id_ref;
61077         CHECK(claim_id->arr_len == 32);
61078         memcpy(claim_id_ref.data, claim_id->elems, 32); FREE(claim_id);
61079         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
61080         htlc_descriptors_constr.datalen = htlc_descriptors->arr_len;
61081         if (htlc_descriptors_constr.datalen > 0)
61082                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
61083         else
61084                 htlc_descriptors_constr.data = NULL;
61085         uint64_t* htlc_descriptors_vals = htlc_descriptors->elems;
61086         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
61087                 uint64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
61088                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
61089                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
61090                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
61091                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
61092                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
61093                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
61094         }
61095         FREE(htlc_descriptors);
61096         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
61097         *ret_copy = BumpTransactionEvent_htlcresolution(claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
61098         uint64_t ret_ref = tag_ptr(ret_copy, true);
61099         return ret_ref;
61100 }
61101
61102 jboolean  __attribute__((export_name("TS_BumpTransactionEvent_eq"))) TS_BumpTransactionEvent_eq(uint64_t a, uint64_t b) {
61103         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
61104         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
61105         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
61106         return ret_conv;
61107 }
61108
61109 void  __attribute__((export_name("TS_Input_free"))) TS_Input_free(uint64_t this_obj) {
61110         LDKInput this_obj_conv;
61111         this_obj_conv.inner = untag_ptr(this_obj);
61112         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61114         Input_free(this_obj_conv);
61115 }
61116
61117 uint64_t  __attribute__((export_name("TS_Input_get_outpoint"))) TS_Input_get_outpoint(uint64_t this_ptr) {
61118         LDKInput 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         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
61124         uint64_t ret_ref = 0;
61125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61127         return ret_ref;
61128 }
61129
61130 void  __attribute__((export_name("TS_Input_set_outpoint"))) TS_Input_set_outpoint(uint64_t this_ptr, uint64_t val) {
61131         LDKInput 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         LDKOutPoint val_conv;
61137         val_conv.inner = untag_ptr(val);
61138         val_conv.is_owned = ptr_is_owned(val);
61139         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61140         val_conv = OutPoint_clone(&val_conv);
61141         Input_set_outpoint(&this_ptr_conv, val_conv);
61142 }
61143
61144 uint64_t  __attribute__((export_name("TS_Input_get_previous_utxo"))) TS_Input_get_previous_utxo(uint64_t this_ptr) {
61145         LDKInput this_ptr_conv;
61146         this_ptr_conv.inner = untag_ptr(this_ptr);
61147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61149         this_ptr_conv.is_owned = false;
61150         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61151         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
61152         return tag_ptr(ret_ref, true);
61153 }
61154
61155 void  __attribute__((export_name("TS_Input_set_previous_utxo"))) TS_Input_set_previous_utxo(uint64_t this_ptr, uint64_t val) {
61156         LDKInput this_ptr_conv;
61157         this_ptr_conv.inner = untag_ptr(this_ptr);
61158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61160         this_ptr_conv.is_owned = false;
61161         void* val_ptr = untag_ptr(val);
61162         CHECK_ACCESS(val_ptr);
61163         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61164         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61165         Input_set_previous_utxo(&this_ptr_conv, val_conv);
61166 }
61167
61168 int64_t  __attribute__((export_name("TS_Input_get_satisfaction_weight"))) TS_Input_get_satisfaction_weight(uint64_t this_ptr) {
61169         LDKInput this_ptr_conv;
61170         this_ptr_conv.inner = untag_ptr(this_ptr);
61171         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61173         this_ptr_conv.is_owned = false;
61174         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
61175         return ret_conv;
61176 }
61177
61178 void  __attribute__((export_name("TS_Input_set_satisfaction_weight"))) TS_Input_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
61179         LDKInput this_ptr_conv;
61180         this_ptr_conv.inner = untag_ptr(this_ptr);
61181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61183         this_ptr_conv.is_owned = false;
61184         Input_set_satisfaction_weight(&this_ptr_conv, val);
61185 }
61186
61187 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) {
61188         LDKOutPoint outpoint_arg_conv;
61189         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61190         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61191         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61192         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61193         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
61194         CHECK_ACCESS(previous_utxo_arg_ptr);
61195         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
61196         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
61197         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
61198         uint64_t ret_ref = 0;
61199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61201         return ret_ref;
61202 }
61203
61204 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
61205         LDKInput ret_var = Input_clone(arg);
61206         uint64_t ret_ref = 0;
61207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61209         return ret_ref;
61210 }
61211 int64_t  __attribute__((export_name("TS_Input_clone_ptr"))) TS_Input_clone_ptr(uint64_t arg) {
61212         LDKInput arg_conv;
61213         arg_conv.inner = untag_ptr(arg);
61214         arg_conv.is_owned = ptr_is_owned(arg);
61215         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61216         arg_conv.is_owned = false;
61217         int64_t ret_conv = Input_clone_ptr(&arg_conv);
61218         return ret_conv;
61219 }
61220
61221 uint64_t  __attribute__((export_name("TS_Input_clone"))) TS_Input_clone(uint64_t orig) {
61222         LDKInput orig_conv;
61223         orig_conv.inner = untag_ptr(orig);
61224         orig_conv.is_owned = ptr_is_owned(orig);
61225         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61226         orig_conv.is_owned = false;
61227         LDKInput ret_var = Input_clone(&orig_conv);
61228         uint64_t ret_ref = 0;
61229         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61230         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61231         return ret_ref;
61232 }
61233
61234 int64_t  __attribute__((export_name("TS_Input_hash"))) TS_Input_hash(uint64_t o) {
61235         LDKInput o_conv;
61236         o_conv.inner = untag_ptr(o);
61237         o_conv.is_owned = ptr_is_owned(o);
61238         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61239         o_conv.is_owned = false;
61240         int64_t ret_conv = Input_hash(&o_conv);
61241         return ret_conv;
61242 }
61243
61244 jboolean  __attribute__((export_name("TS_Input_eq"))) TS_Input_eq(uint64_t a, uint64_t b) {
61245         LDKInput a_conv;
61246         a_conv.inner = untag_ptr(a);
61247         a_conv.is_owned = ptr_is_owned(a);
61248         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61249         a_conv.is_owned = false;
61250         LDKInput b_conv;
61251         b_conv.inner = untag_ptr(b);
61252         b_conv.is_owned = ptr_is_owned(b);
61253         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61254         b_conv.is_owned = false;
61255         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
61256         return ret_conv;
61257 }
61258
61259 void  __attribute__((export_name("TS_Utxo_free"))) TS_Utxo_free(uint64_t this_obj) {
61260         LDKUtxo this_obj_conv;
61261         this_obj_conv.inner = untag_ptr(this_obj);
61262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61264         Utxo_free(this_obj_conv);
61265 }
61266
61267 uint64_t  __attribute__((export_name("TS_Utxo_get_outpoint"))) TS_Utxo_get_outpoint(uint64_t this_ptr) {
61268         LDKUtxo this_ptr_conv;
61269         this_ptr_conv.inner = untag_ptr(this_ptr);
61270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61272         this_ptr_conv.is_owned = false;
61273         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
61274         uint64_t ret_ref = 0;
61275         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61276         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61277         return ret_ref;
61278 }
61279
61280 void  __attribute__((export_name("TS_Utxo_set_outpoint"))) TS_Utxo_set_outpoint(uint64_t this_ptr, uint64_t val) {
61281         LDKUtxo this_ptr_conv;
61282         this_ptr_conv.inner = untag_ptr(this_ptr);
61283         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61284         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61285         this_ptr_conv.is_owned = false;
61286         LDKOutPoint val_conv;
61287         val_conv.inner = untag_ptr(val);
61288         val_conv.is_owned = ptr_is_owned(val);
61289         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
61290         val_conv = OutPoint_clone(&val_conv);
61291         Utxo_set_outpoint(&this_ptr_conv, val_conv);
61292 }
61293
61294 uint64_t  __attribute__((export_name("TS_Utxo_get_output"))) TS_Utxo_get_output(uint64_t this_ptr) {
61295         LDKUtxo this_ptr_conv;
61296         this_ptr_conv.inner = untag_ptr(this_ptr);
61297         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61299         this_ptr_conv.is_owned = false;
61300         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
61301         *ret_ref = Utxo_get_output(&this_ptr_conv);
61302         return tag_ptr(ret_ref, true);
61303 }
61304
61305 void  __attribute__((export_name("TS_Utxo_set_output"))) TS_Utxo_set_output(uint64_t this_ptr, uint64_t val) {
61306         LDKUtxo this_ptr_conv;
61307         this_ptr_conv.inner = untag_ptr(this_ptr);
61308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61310         this_ptr_conv.is_owned = false;
61311         void* val_ptr = untag_ptr(val);
61312         CHECK_ACCESS(val_ptr);
61313         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
61314         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
61315         Utxo_set_output(&this_ptr_conv, val_conv);
61316 }
61317
61318 int64_t  __attribute__((export_name("TS_Utxo_get_satisfaction_weight"))) TS_Utxo_get_satisfaction_weight(uint64_t this_ptr) {
61319         LDKUtxo this_ptr_conv;
61320         this_ptr_conv.inner = untag_ptr(this_ptr);
61321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61323         this_ptr_conv.is_owned = false;
61324         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
61325         return ret_conv;
61326 }
61327
61328 void  __attribute__((export_name("TS_Utxo_set_satisfaction_weight"))) TS_Utxo_set_satisfaction_weight(uint64_t this_ptr, int64_t val) {
61329         LDKUtxo this_ptr_conv;
61330         this_ptr_conv.inner = untag_ptr(this_ptr);
61331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61333         this_ptr_conv.is_owned = false;
61334         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
61335 }
61336
61337 uint64_t  __attribute__((export_name("TS_Utxo_new"))) TS_Utxo_new(uint64_t outpoint_arg, uint64_t output_arg, int64_t satisfaction_weight_arg) {
61338         LDKOutPoint outpoint_arg_conv;
61339         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
61340         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
61341         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
61342         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
61343         void* output_arg_ptr = untag_ptr(output_arg);
61344         CHECK_ACCESS(output_arg_ptr);
61345         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
61346         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
61347         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
61348         uint64_t ret_ref = 0;
61349         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61350         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61351         return ret_ref;
61352 }
61353
61354 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
61355         LDKUtxo ret_var = Utxo_clone(arg);
61356         uint64_t ret_ref = 0;
61357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61359         return ret_ref;
61360 }
61361 int64_t  __attribute__((export_name("TS_Utxo_clone_ptr"))) TS_Utxo_clone_ptr(uint64_t arg) {
61362         LDKUtxo arg_conv;
61363         arg_conv.inner = untag_ptr(arg);
61364         arg_conv.is_owned = ptr_is_owned(arg);
61365         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61366         arg_conv.is_owned = false;
61367         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
61368         return ret_conv;
61369 }
61370
61371 uint64_t  __attribute__((export_name("TS_Utxo_clone"))) TS_Utxo_clone(uint64_t orig) {
61372         LDKUtxo orig_conv;
61373         orig_conv.inner = untag_ptr(orig);
61374         orig_conv.is_owned = ptr_is_owned(orig);
61375         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61376         orig_conv.is_owned = false;
61377         LDKUtxo ret_var = Utxo_clone(&orig_conv);
61378         uint64_t ret_ref = 0;
61379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61381         return ret_ref;
61382 }
61383
61384 int64_t  __attribute__((export_name("TS_Utxo_hash"))) TS_Utxo_hash(uint64_t o) {
61385         LDKUtxo o_conv;
61386         o_conv.inner = untag_ptr(o);
61387         o_conv.is_owned = ptr_is_owned(o);
61388         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
61389         o_conv.is_owned = false;
61390         int64_t ret_conv = Utxo_hash(&o_conv);
61391         return ret_conv;
61392 }
61393
61394 jboolean  __attribute__((export_name("TS_Utxo_eq"))) TS_Utxo_eq(uint64_t a, uint64_t b) {
61395         LDKUtxo a_conv;
61396         a_conv.inner = untag_ptr(a);
61397         a_conv.is_owned = ptr_is_owned(a);
61398         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61399         a_conv.is_owned = false;
61400         LDKUtxo b_conv;
61401         b_conv.inner = untag_ptr(b);
61402         b_conv.is_owned = ptr_is_owned(b);
61403         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
61404         b_conv.is_owned = false;
61405         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
61406         return ret_conv;
61407 }
61408
61409 uint64_t  __attribute__((export_name("TS_Utxo_new_p2pkh"))) TS_Utxo_new_p2pkh(uint64_t outpoint, int64_t value, int8_tArray pubkey_hash) {
61410         LDKOutPoint outpoint_conv;
61411         outpoint_conv.inner = untag_ptr(outpoint);
61412         outpoint_conv.is_owned = ptr_is_owned(outpoint);
61413         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
61414         outpoint_conv = OutPoint_clone(&outpoint_conv);
61415         uint8_t pubkey_hash_arr[20];
61416         CHECK(pubkey_hash->arr_len == 20);
61417         memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash);
61418         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
61419         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
61420         uint64_t ret_ref = 0;
61421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61423         return ret_ref;
61424 }
61425
61426 void  __attribute__((export_name("TS_CoinSelection_free"))) TS_CoinSelection_free(uint64_t this_obj) {
61427         LDKCoinSelection this_obj_conv;
61428         this_obj_conv.inner = untag_ptr(this_obj);
61429         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61431         CoinSelection_free(this_obj_conv);
61432 }
61433
61434 uint64_tArray  __attribute__((export_name("TS_CoinSelection_get_confirmed_utxos"))) TS_CoinSelection_get_confirmed_utxos(uint64_t this_ptr) {
61435         LDKCoinSelection this_ptr_conv;
61436         this_ptr_conv.inner = untag_ptr(this_ptr);
61437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61439         this_ptr_conv.is_owned = false;
61440         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
61441         uint64_tArray ret_arr = NULL;
61442         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
61443         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
61444         for (size_t g = 0; g < ret_var.datalen; g++) {
61445                 LDKUtxo ret_conv_6_var = ret_var.data[g];
61446                 uint64_t ret_conv_6_ref = 0;
61447                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
61448                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
61449                 ret_arr_ptr[g] = ret_conv_6_ref;
61450         }
61451         
61452         FREE(ret_var.data);
61453         return ret_arr;
61454 }
61455
61456 void  __attribute__((export_name("TS_CoinSelection_set_confirmed_utxos"))) TS_CoinSelection_set_confirmed_utxos(uint64_t this_ptr, uint64_tArray val) {
61457         LDKCoinSelection this_ptr_conv;
61458         this_ptr_conv.inner = untag_ptr(this_ptr);
61459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61461         this_ptr_conv.is_owned = false;
61462         LDKCVec_UtxoZ val_constr;
61463         val_constr.datalen = val->arr_len;
61464         if (val_constr.datalen > 0)
61465                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
61466         else
61467                 val_constr.data = NULL;
61468         uint64_t* val_vals = val->elems;
61469         for (size_t g = 0; g < val_constr.datalen; g++) {
61470                 uint64_t val_conv_6 = val_vals[g];
61471                 LDKUtxo val_conv_6_conv;
61472                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
61473                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
61474                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
61475                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
61476                 val_constr.data[g] = val_conv_6_conv;
61477         }
61478         FREE(val);
61479         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
61480 }
61481
61482 uint64_t  __attribute__((export_name("TS_CoinSelection_get_change_output"))) TS_CoinSelection_get_change_output(uint64_t this_ptr) {
61483         LDKCoinSelection this_ptr_conv;
61484         this_ptr_conv.inner = untag_ptr(this_ptr);
61485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61487         this_ptr_conv.is_owned = false;
61488         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
61489         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
61490         uint64_t ret_ref = tag_ptr(ret_copy, true);
61491         return ret_ref;
61492 }
61493
61494 void  __attribute__((export_name("TS_CoinSelection_set_change_output"))) TS_CoinSelection_set_change_output(uint64_t this_ptr, uint64_t val) {
61495         LDKCoinSelection this_ptr_conv;
61496         this_ptr_conv.inner = untag_ptr(this_ptr);
61497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61499         this_ptr_conv.is_owned = false;
61500         void* val_ptr = untag_ptr(val);
61501         CHECK_ACCESS(val_ptr);
61502         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
61503         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
61504         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
61505 }
61506
61507 uint64_t  __attribute__((export_name("TS_CoinSelection_new"))) TS_CoinSelection_new(uint64_tArray confirmed_utxos_arg, uint64_t change_output_arg) {
61508         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
61509         confirmed_utxos_arg_constr.datalen = confirmed_utxos_arg->arr_len;
61510         if (confirmed_utxos_arg_constr.datalen > 0)
61511                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
61512         else
61513                 confirmed_utxos_arg_constr.data = NULL;
61514         uint64_t* confirmed_utxos_arg_vals = confirmed_utxos_arg->elems;
61515         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
61516                 uint64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
61517                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
61518                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
61519                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
61520                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
61521                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
61522                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
61523         }
61524         FREE(confirmed_utxos_arg);
61525         void* change_output_arg_ptr = untag_ptr(change_output_arg);
61526         CHECK_ACCESS(change_output_arg_ptr);
61527         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
61528         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
61529         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
61530         uint64_t ret_ref = 0;
61531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61533         return ret_ref;
61534 }
61535
61536 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
61537         LDKCoinSelection ret_var = CoinSelection_clone(arg);
61538         uint64_t ret_ref = 0;
61539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61541         return ret_ref;
61542 }
61543 int64_t  __attribute__((export_name("TS_CoinSelection_clone_ptr"))) TS_CoinSelection_clone_ptr(uint64_t arg) {
61544         LDKCoinSelection arg_conv;
61545         arg_conv.inner = untag_ptr(arg);
61546         arg_conv.is_owned = ptr_is_owned(arg);
61547         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
61548         arg_conv.is_owned = false;
61549         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
61550         return ret_conv;
61551 }
61552
61553 uint64_t  __attribute__((export_name("TS_CoinSelection_clone"))) TS_CoinSelection_clone(uint64_t orig) {
61554         LDKCoinSelection orig_conv;
61555         orig_conv.inner = untag_ptr(orig);
61556         orig_conv.is_owned = ptr_is_owned(orig);
61557         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
61558         orig_conv.is_owned = false;
61559         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
61560         uint64_t ret_ref = 0;
61561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61563         return ret_ref;
61564 }
61565
61566 void  __attribute__((export_name("TS_CoinSelectionSource_free"))) TS_CoinSelectionSource_free(uint64_t this_ptr) {
61567         if (!ptr_is_owned(this_ptr)) return;
61568         void* this_ptr_ptr = untag_ptr(this_ptr);
61569         CHECK_ACCESS(this_ptr_ptr);
61570         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
61571         FREE(untag_ptr(this_ptr));
61572         CoinSelectionSource_free(this_ptr_conv);
61573 }
61574
61575 void  __attribute__((export_name("TS_WalletSource_free"))) TS_WalletSource_free(uint64_t this_ptr) {
61576         if (!ptr_is_owned(this_ptr)) return;
61577         void* this_ptr_ptr = untag_ptr(this_ptr);
61578         CHECK_ACCESS(this_ptr_ptr);
61579         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
61580         FREE(untag_ptr(this_ptr));
61581         WalletSource_free(this_ptr_conv);
61582 }
61583
61584 void  __attribute__((export_name("TS_Wallet_free"))) TS_Wallet_free(uint64_t this_obj) {
61585         LDKWallet this_obj_conv;
61586         this_obj_conv.inner = untag_ptr(this_obj);
61587         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61589         Wallet_free(this_obj_conv);
61590 }
61591
61592 uint64_t  __attribute__((export_name("TS_Wallet_new"))) TS_Wallet_new(uint64_t source, uint64_t logger) {
61593         void* source_ptr = untag_ptr(source);
61594         CHECK_ACCESS(source_ptr);
61595         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
61596         if (source_conv.free == LDKWalletSource_JCalls_free) {
61597                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61598                 LDKWalletSource_JCalls_cloned(&source_conv);
61599         }
61600         void* logger_ptr = untag_ptr(logger);
61601         CHECK_ACCESS(logger_ptr);
61602         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61603         if (logger_conv.free == LDKLogger_JCalls_free) {
61604                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61605                 LDKLogger_JCalls_cloned(&logger_conv);
61606         }
61607         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
61608         uint64_t ret_ref = 0;
61609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61611         return ret_ref;
61612 }
61613
61614 uint64_t  __attribute__((export_name("TS_Wallet_as_CoinSelectionSource"))) TS_Wallet_as_CoinSelectionSource(uint64_t this_arg) {
61615         LDKWallet this_arg_conv;
61616         this_arg_conv.inner = untag_ptr(this_arg);
61617         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61619         this_arg_conv.is_owned = false;
61620         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
61621         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
61622         return tag_ptr(ret_ret, true);
61623 }
61624
61625 void  __attribute__((export_name("TS_BumpTransactionEventHandler_free"))) TS_BumpTransactionEventHandler_free(uint64_t this_obj) {
61626         LDKBumpTransactionEventHandler this_obj_conv;
61627         this_obj_conv.inner = untag_ptr(this_obj);
61628         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61630         BumpTransactionEventHandler_free(this_obj_conv);
61631 }
61632
61633 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) {
61634         void* broadcaster_ptr = untag_ptr(broadcaster);
61635         CHECK_ACCESS(broadcaster_ptr);
61636         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
61637         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
61638                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61639                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
61640         }
61641         void* utxo_source_ptr = untag_ptr(utxo_source);
61642         CHECK_ACCESS(utxo_source_ptr);
61643         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
61644         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
61645                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61646                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
61647         }
61648         void* signer_provider_ptr = untag_ptr(signer_provider);
61649         CHECK_ACCESS(signer_provider_ptr);
61650         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
61651         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
61652                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61653                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
61654         }
61655         void* logger_ptr = untag_ptr(logger);
61656         CHECK_ACCESS(logger_ptr);
61657         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61658         if (logger_conv.free == LDKLogger_JCalls_free) {
61659                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61660                 LDKLogger_JCalls_cloned(&logger_conv);
61661         }
61662         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
61663         uint64_t ret_ref = 0;
61664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61666         return ret_ref;
61667 }
61668
61669 void  __attribute__((export_name("TS_BumpTransactionEventHandler_handle_event"))) TS_BumpTransactionEventHandler_handle_event(uint64_t this_arg, uint64_t event) {
61670         LDKBumpTransactionEventHandler this_arg_conv;
61671         this_arg_conv.inner = untag_ptr(this_arg);
61672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61674         this_arg_conv.is_owned = false;
61675         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
61676         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
61677 }
61678
61679 void  __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_free(uint64_t this_ptr) {
61680         if (!ptr_is_owned(this_ptr)) return;
61681         void* this_ptr_ptr = untag_ptr(this_ptr);
61682         CHECK_ACCESS(this_ptr_ptr);
61683         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
61684         FREE(untag_ptr(this_ptr));
61685         GossipSync_free(this_ptr_conv);
61686 }
61687
61688 uint64_t  __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) {
61689         LDKP2PGossipSync a_conv;
61690         a_conv.inner = untag_ptr(a);
61691         a_conv.is_owned = ptr_is_owned(a);
61692         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61693         a_conv.is_owned = false;
61694         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
61695         *ret_copy = GossipSync_p2_p(&a_conv);
61696         uint64_t ret_ref = tag_ptr(ret_copy, true);
61697         return ret_ref;
61698 }
61699
61700 uint64_t  __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) {
61701         LDKRapidGossipSync a_conv;
61702         a_conv.inner = untag_ptr(a);
61703         a_conv.is_owned = ptr_is_owned(a);
61704         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61705         a_conv.is_owned = false;
61706         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
61707         *ret_copy = GossipSync_rapid(&a_conv);
61708         uint64_t ret_ref = tag_ptr(ret_copy, true);
61709         return ret_ref;
61710 }
61711
61712 uint64_t  __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() {
61713         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
61714         *ret_copy = GossipSync_none();
61715         uint64_t ret_ref = tag_ptr(ret_copy, true);
61716         return ret_ref;
61717 }
61718
61719 void  __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) {
61720         LDKRapidGossipSync this_obj_conv;
61721         this_obj_conv.inner = untag_ptr(this_obj);
61722         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61724         RapidGossipSync_free(this_obj_conv);
61725 }
61726
61727 uint64_t  __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) {
61728         LDKNetworkGraph network_graph_conv;
61729         network_graph_conv.inner = untag_ptr(network_graph);
61730         network_graph_conv.is_owned = ptr_is_owned(network_graph);
61731         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
61732         network_graph_conv.is_owned = false;
61733         void* logger_ptr = untag_ptr(logger);
61734         CHECK_ACCESS(logger_ptr);
61735         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
61736         if (logger_conv.free == LDKLogger_JCalls_free) {
61737                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61738                 LDKLogger_JCalls_cloned(&logger_conv);
61739         }
61740         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
61741         uint64_t ret_ref = 0;
61742         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61743         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61744         return ret_ref;
61745 }
61746
61747 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) {
61748         LDKRapidGossipSync this_arg_conv;
61749         this_arg_conv.inner = untag_ptr(this_arg);
61750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61752         this_arg_conv.is_owned = false;
61753         LDKu8slice update_data_ref;
61754         update_data_ref.datalen = update_data->arr_len;
61755         update_data_ref.data = update_data->elems;
61756         void* current_time_unix_ptr = untag_ptr(current_time_unix);
61757         CHECK_ACCESS(current_time_unix_ptr);
61758         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
61759         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
61760         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
61761         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
61762         FREE(update_data);
61763         return tag_ptr(ret_conv, true);
61764 }
61765
61766 jboolean  __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) {
61767         LDKRapidGossipSync this_arg_conv;
61768         this_arg_conv.inner = untag_ptr(this_arg);
61769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61771         this_arg_conv.is_owned = false;
61772         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
61773         return ret_conv;
61774 }
61775
61776 void  __attribute__((export_name("TS_GraphSyncError_free"))) TS_GraphSyncError_free(uint64_t this_ptr) {
61777         if (!ptr_is_owned(this_ptr)) return;
61778         void* this_ptr_ptr = untag_ptr(this_ptr);
61779         CHECK_ACCESS(this_ptr_ptr);
61780         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
61781         FREE(untag_ptr(this_ptr));
61782         GraphSyncError_free(this_ptr_conv);
61783 }
61784
61785 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
61786         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
61787         *ret_copy = GraphSyncError_clone(arg);
61788         uint64_t ret_ref = tag_ptr(ret_copy, true);
61789         return ret_ref;
61790 }
61791 int64_t  __attribute__((export_name("TS_GraphSyncError_clone_ptr"))) TS_GraphSyncError_clone_ptr(uint64_t arg) {
61792         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
61793         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
61794         return ret_conv;
61795 }
61796
61797 uint64_t  __attribute__((export_name("TS_GraphSyncError_clone"))) TS_GraphSyncError_clone(uint64_t orig) {
61798         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
61799         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
61800         *ret_copy = GraphSyncError_clone(orig_conv);
61801         uint64_t ret_ref = tag_ptr(ret_copy, true);
61802         return ret_ref;
61803 }
61804
61805 uint64_t  __attribute__((export_name("TS_GraphSyncError_decode_error"))) TS_GraphSyncError_decode_error(uint64_t a) {
61806         void* a_ptr = untag_ptr(a);
61807         CHECK_ACCESS(a_ptr);
61808         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
61809         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
61810         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
61811         *ret_copy = GraphSyncError_decode_error(a_conv);
61812         uint64_t ret_ref = tag_ptr(ret_copy, true);
61813         return ret_ref;
61814 }
61815
61816 uint64_t  __attribute__((export_name("TS_GraphSyncError_lightning_error"))) TS_GraphSyncError_lightning_error(uint64_t a) {
61817         LDKLightningError a_conv;
61818         a_conv.inner = untag_ptr(a);
61819         a_conv.is_owned = ptr_is_owned(a);
61820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
61821         a_conv = LightningError_clone(&a_conv);
61822         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
61823         *ret_copy = GraphSyncError_lightning_error(a_conv);
61824         uint64_t ret_ref = tag_ptr(ret_copy, true);
61825         return ret_ref;
61826 }
61827
61828 void  __attribute__((export_name("TS_Bolt11ParseError_free"))) TS_Bolt11ParseError_free(uint64_t this_ptr) {
61829         if (!ptr_is_owned(this_ptr)) return;
61830         void* this_ptr_ptr = untag_ptr(this_ptr);
61831         CHECK_ACCESS(this_ptr_ptr);
61832         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
61833         FREE(untag_ptr(this_ptr));
61834         Bolt11ParseError_free(this_ptr_conv);
61835 }
61836
61837 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
61838         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61839         *ret_copy = Bolt11ParseError_clone(arg);
61840         uint64_t ret_ref = tag_ptr(ret_copy, true);
61841         return ret_ref;
61842 }
61843 int64_t  __attribute__((export_name("TS_Bolt11ParseError_clone_ptr"))) TS_Bolt11ParseError_clone_ptr(uint64_t arg) {
61844         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
61845         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
61846         return ret_conv;
61847 }
61848
61849 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_clone"))) TS_Bolt11ParseError_clone(uint64_t orig) {
61850         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
61851         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61852         *ret_copy = Bolt11ParseError_clone(orig_conv);
61853         uint64_t ret_ref = tag_ptr(ret_copy, true);
61854         return ret_ref;
61855 }
61856
61857 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bech32_error"))) TS_Bolt11ParseError_bech32_error(uint64_t a) {
61858         void* a_ptr = untag_ptr(a);
61859         CHECK_ACCESS(a_ptr);
61860         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
61861         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
61862         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61863         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
61864         uint64_t ret_ref = tag_ptr(ret_copy, true);
61865         return ret_ref;
61866 }
61867
61868 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_parse_amount_error"))) TS_Bolt11ParseError_parse_amount_error(int32_t a) {
61869         
61870         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61871         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
61872         uint64_t ret_ref = tag_ptr(ret_copy, true);
61873         return ret_ref;
61874 }
61875
61876 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_signature"))) TS_Bolt11ParseError_malformed_signature(uint32_t a) {
61877         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
61878         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61879         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
61880         uint64_t ret_ref = tag_ptr(ret_copy, true);
61881         return ret_ref;
61882 }
61883
61884 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_bad_prefix"))) TS_Bolt11ParseError_bad_prefix() {
61885         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61886         *ret_copy = Bolt11ParseError_bad_prefix();
61887         uint64_t ret_ref = tag_ptr(ret_copy, true);
61888         return ret_ref;
61889 }
61890
61891 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_currency"))) TS_Bolt11ParseError_unknown_currency() {
61892         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61893         *ret_copy = Bolt11ParseError_unknown_currency();
61894         uint64_t ret_ref = tag_ptr(ret_copy, true);
61895         return ret_ref;
61896 }
61897
61898 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unknown_si_prefix"))) TS_Bolt11ParseError_unknown_si_prefix() {
61899         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61900         *ret_copy = Bolt11ParseError_unknown_si_prefix();
61901         uint64_t ret_ref = tag_ptr(ret_copy, true);
61902         return ret_ref;
61903 }
61904
61905 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_malformed_hrp"))) TS_Bolt11ParseError_malformed_hrp() {
61906         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61907         *ret_copy = Bolt11ParseError_malformed_hrp();
61908         uint64_t ret_ref = tag_ptr(ret_copy, true);
61909         return ret_ref;
61910 }
61911
61912 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_too_short_data_part"))) TS_Bolt11ParseError_too_short_data_part() {
61913         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61914         *ret_copy = Bolt11ParseError_too_short_data_part();
61915         uint64_t ret_ref = tag_ptr(ret_copy, true);
61916         return ret_ref;
61917 }
61918
61919 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_unexpected_end_of_tagged_fields"))) TS_Bolt11ParseError_unexpected_end_of_tagged_fields() {
61920         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61921         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
61922         uint64_t ret_ref = tag_ptr(ret_copy, true);
61923         return ret_ref;
61924 }
61925
61926 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_description_decode_error"))) TS_Bolt11ParseError_description_decode_error(int32_t a) {
61927         
61928         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61929         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
61930         uint64_t ret_ref = tag_ptr(ret_copy, true);
61931         return ret_ref;
61932 }
61933
61934 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_padding_error"))) TS_Bolt11ParseError_padding_error() {
61935         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61936         *ret_copy = Bolt11ParseError_padding_error();
61937         uint64_t ret_ref = tag_ptr(ret_copy, true);
61938         return ret_ref;
61939 }
61940
61941 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_integer_overflow_error"))) TS_Bolt11ParseError_integer_overflow_error() {
61942         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61943         *ret_copy = Bolt11ParseError_integer_overflow_error();
61944         uint64_t ret_ref = tag_ptr(ret_copy, true);
61945         return ret_ref;
61946 }
61947
61948 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_seg_wit_program_length"))) TS_Bolt11ParseError_invalid_seg_wit_program_length() {
61949         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61950         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
61951         uint64_t ret_ref = tag_ptr(ret_copy, true);
61952         return ret_ref;
61953 }
61954
61955 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_pub_key_hash_length"))) TS_Bolt11ParseError_invalid_pub_key_hash_length() {
61956         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61957         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
61958         uint64_t ret_ref = tag_ptr(ret_copy, true);
61959         return ret_ref;
61960 }
61961
61962 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_script_hash_length"))) TS_Bolt11ParseError_invalid_script_hash_length() {
61963         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61964         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
61965         uint64_t ret_ref = tag_ptr(ret_copy, true);
61966         return ret_ref;
61967 }
61968
61969 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_recovery_id"))) TS_Bolt11ParseError_invalid_recovery_id() {
61970         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61971         *ret_copy = Bolt11ParseError_invalid_recovery_id();
61972         uint64_t ret_ref = tag_ptr(ret_copy, true);
61973         return ret_ref;
61974 }
61975
61976 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_invalid_slice_length"))) TS_Bolt11ParseError_invalid_slice_length(jstring a) {
61977         LDKStr a_conv = str_ref_to_owned_c(a);
61978         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61979         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
61980         uint64_t ret_ref = tag_ptr(ret_copy, true);
61981         return ret_ref;
61982 }
61983
61984 uint64_t  __attribute__((export_name("TS_Bolt11ParseError_skip"))) TS_Bolt11ParseError_skip() {
61985         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
61986         *ret_copy = Bolt11ParseError_skip();
61987         uint64_t ret_ref = tag_ptr(ret_copy, true);
61988         return ret_ref;
61989 }
61990
61991 jboolean  __attribute__((export_name("TS_Bolt11ParseError_eq"))) TS_Bolt11ParseError_eq(uint64_t a, uint64_t b) {
61992         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
61993         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
61994         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
61995         return ret_conv;
61996 }
61997
61998 void  __attribute__((export_name("TS_ParseOrSemanticError_free"))) TS_ParseOrSemanticError_free(uint64_t this_ptr) {
61999         if (!ptr_is_owned(this_ptr)) return;
62000         void* this_ptr_ptr = untag_ptr(this_ptr);
62001         CHECK_ACCESS(this_ptr_ptr);
62002         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
62003         FREE(untag_ptr(this_ptr));
62004         ParseOrSemanticError_free(this_ptr_conv);
62005 }
62006
62007 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
62008         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
62009         *ret_copy = ParseOrSemanticError_clone(arg);
62010         uint64_t ret_ref = tag_ptr(ret_copy, true);
62011         return ret_ref;
62012 }
62013 int64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone_ptr"))) TS_ParseOrSemanticError_clone_ptr(uint64_t arg) {
62014         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
62015         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
62016         return ret_conv;
62017 }
62018
62019 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_clone"))) TS_ParseOrSemanticError_clone(uint64_t orig) {
62020         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
62021         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
62022         *ret_copy = ParseOrSemanticError_clone(orig_conv);
62023         uint64_t ret_ref = tag_ptr(ret_copy, true);
62024         return ret_ref;
62025 }
62026
62027 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_parse_error"))) TS_ParseOrSemanticError_parse_error(uint64_t a) {
62028         void* a_ptr = untag_ptr(a);
62029         CHECK_ACCESS(a_ptr);
62030         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
62031         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
62032         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
62033         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
62034         uint64_t ret_ref = tag_ptr(ret_copy, true);
62035         return ret_ref;
62036 }
62037
62038 uint64_t  __attribute__((export_name("TS_ParseOrSemanticError_semantic_error"))) TS_ParseOrSemanticError_semantic_error(uint32_t a) {
62039         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_js(a);
62040         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
62041         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
62042         uint64_t ret_ref = tag_ptr(ret_copy, true);
62043         return ret_ref;
62044 }
62045
62046 jboolean  __attribute__((export_name("TS_ParseOrSemanticError_eq"))) TS_ParseOrSemanticError_eq(uint64_t a, uint64_t b) {
62047         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
62048         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
62049         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
62050         return ret_conv;
62051 }
62052
62053 void  __attribute__((export_name("TS_Bolt11Invoice_free"))) TS_Bolt11Invoice_free(uint64_t this_obj) {
62054         LDKBolt11Invoice this_obj_conv;
62055         this_obj_conv.inner = untag_ptr(this_obj);
62056         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62057         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62058         Bolt11Invoice_free(this_obj_conv);
62059 }
62060
62061 jboolean  __attribute__((export_name("TS_Bolt11Invoice_eq"))) TS_Bolt11Invoice_eq(uint64_t a, uint64_t b) {
62062         LDKBolt11Invoice a_conv;
62063         a_conv.inner = untag_ptr(a);
62064         a_conv.is_owned = ptr_is_owned(a);
62065         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62066         a_conv.is_owned = false;
62067         LDKBolt11Invoice b_conv;
62068         b_conv.inner = untag_ptr(b);
62069         b_conv.is_owned = ptr_is_owned(b);
62070         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62071         b_conv.is_owned = false;
62072         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
62073         return ret_conv;
62074 }
62075
62076 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
62077         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
62078         uint64_t ret_ref = 0;
62079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62081         return ret_ref;
62082 }
62083 int64_t  __attribute__((export_name("TS_Bolt11Invoice_clone_ptr"))) TS_Bolt11Invoice_clone_ptr(uint64_t arg) {
62084         LDKBolt11Invoice arg_conv;
62085         arg_conv.inner = untag_ptr(arg);
62086         arg_conv.is_owned = ptr_is_owned(arg);
62087         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62088         arg_conv.is_owned = false;
62089         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
62090         return ret_conv;
62091 }
62092
62093 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_clone"))) TS_Bolt11Invoice_clone(uint64_t orig) {
62094         LDKBolt11Invoice orig_conv;
62095         orig_conv.inner = untag_ptr(orig);
62096         orig_conv.is_owned = ptr_is_owned(orig);
62097         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62098         orig_conv.is_owned = false;
62099         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
62100         uint64_t ret_ref = 0;
62101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62103         return ret_ref;
62104 }
62105
62106 int64_t  __attribute__((export_name("TS_Bolt11Invoice_hash"))) TS_Bolt11Invoice_hash(uint64_t o) {
62107         LDKBolt11Invoice o_conv;
62108         o_conv.inner = untag_ptr(o);
62109         o_conv.is_owned = ptr_is_owned(o);
62110         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62111         o_conv.is_owned = false;
62112         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
62113         return ret_conv;
62114 }
62115
62116 void  __attribute__((export_name("TS_SignedRawBolt11Invoice_free"))) TS_SignedRawBolt11Invoice_free(uint64_t this_obj) {
62117         LDKSignedRawBolt11Invoice this_obj_conv;
62118         this_obj_conv.inner = untag_ptr(this_obj);
62119         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62121         SignedRawBolt11Invoice_free(this_obj_conv);
62122 }
62123
62124 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_eq"))) TS_SignedRawBolt11Invoice_eq(uint64_t a, uint64_t b) {
62125         LDKSignedRawBolt11Invoice a_conv;
62126         a_conv.inner = untag_ptr(a);
62127         a_conv.is_owned = ptr_is_owned(a);
62128         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62129         a_conv.is_owned = false;
62130         LDKSignedRawBolt11Invoice b_conv;
62131         b_conv.inner = untag_ptr(b);
62132         b_conv.is_owned = ptr_is_owned(b);
62133         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62134         b_conv.is_owned = false;
62135         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
62136         return ret_conv;
62137 }
62138
62139 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
62140         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
62141         uint64_t ret_ref = 0;
62142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62144         return ret_ref;
62145 }
62146 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone_ptr"))) TS_SignedRawBolt11Invoice_clone_ptr(uint64_t arg) {
62147         LDKSignedRawBolt11Invoice arg_conv;
62148         arg_conv.inner = untag_ptr(arg);
62149         arg_conv.is_owned = ptr_is_owned(arg);
62150         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62151         arg_conv.is_owned = false;
62152         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
62153         return ret_conv;
62154 }
62155
62156 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_clone"))) TS_SignedRawBolt11Invoice_clone(uint64_t orig) {
62157         LDKSignedRawBolt11Invoice orig_conv;
62158         orig_conv.inner = untag_ptr(orig);
62159         orig_conv.is_owned = ptr_is_owned(orig);
62160         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62161         orig_conv.is_owned = false;
62162         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
62163         uint64_t ret_ref = 0;
62164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62166         return ret_ref;
62167 }
62168
62169 int64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_hash"))) TS_SignedRawBolt11Invoice_hash(uint64_t o) {
62170         LDKSignedRawBolt11Invoice o_conv;
62171         o_conv.inner = untag_ptr(o);
62172         o_conv.is_owned = ptr_is_owned(o);
62173         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62174         o_conv.is_owned = false;
62175         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
62176         return ret_conv;
62177 }
62178
62179 void  __attribute__((export_name("TS_RawBolt11Invoice_free"))) TS_RawBolt11Invoice_free(uint64_t this_obj) {
62180         LDKRawBolt11Invoice this_obj_conv;
62181         this_obj_conv.inner = untag_ptr(this_obj);
62182         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62184         RawBolt11Invoice_free(this_obj_conv);
62185 }
62186
62187 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_get_data"))) TS_RawBolt11Invoice_get_data(uint64_t this_ptr) {
62188         LDKRawBolt11Invoice this_ptr_conv;
62189         this_ptr_conv.inner = untag_ptr(this_ptr);
62190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62192         this_ptr_conv.is_owned = false;
62193         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
62194         uint64_t ret_ref = 0;
62195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62197         return ret_ref;
62198 }
62199
62200 void  __attribute__((export_name("TS_RawBolt11Invoice_set_data"))) TS_RawBolt11Invoice_set_data(uint64_t this_ptr, uint64_t val) {
62201         LDKRawBolt11Invoice this_ptr_conv;
62202         this_ptr_conv.inner = untag_ptr(this_ptr);
62203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62205         this_ptr_conv.is_owned = false;
62206         LDKRawDataPart val_conv;
62207         val_conv.inner = untag_ptr(val);
62208         val_conv.is_owned = ptr_is_owned(val);
62209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62210         val_conv = RawDataPart_clone(&val_conv);
62211         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
62212 }
62213
62214 jboolean  __attribute__((export_name("TS_RawBolt11Invoice_eq"))) TS_RawBolt11Invoice_eq(uint64_t a, uint64_t b) {
62215         LDKRawBolt11Invoice a_conv;
62216         a_conv.inner = untag_ptr(a);
62217         a_conv.is_owned = ptr_is_owned(a);
62218         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62219         a_conv.is_owned = false;
62220         LDKRawBolt11Invoice b_conv;
62221         b_conv.inner = untag_ptr(b);
62222         b_conv.is_owned = ptr_is_owned(b);
62223         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62224         b_conv.is_owned = false;
62225         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
62226         return ret_conv;
62227 }
62228
62229 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
62230         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
62231         uint64_t ret_ref = 0;
62232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62234         return ret_ref;
62235 }
62236 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone_ptr"))) TS_RawBolt11Invoice_clone_ptr(uint64_t arg) {
62237         LDKRawBolt11Invoice arg_conv;
62238         arg_conv.inner = untag_ptr(arg);
62239         arg_conv.is_owned = ptr_is_owned(arg);
62240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62241         arg_conv.is_owned = false;
62242         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
62243         return ret_conv;
62244 }
62245
62246 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_clone"))) TS_RawBolt11Invoice_clone(uint64_t orig) {
62247         LDKRawBolt11Invoice orig_conv;
62248         orig_conv.inner = untag_ptr(orig);
62249         orig_conv.is_owned = ptr_is_owned(orig);
62250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62251         orig_conv.is_owned = false;
62252         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
62253         uint64_t ret_ref = 0;
62254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62256         return ret_ref;
62257 }
62258
62259 int64_t  __attribute__((export_name("TS_RawBolt11Invoice_hash"))) TS_RawBolt11Invoice_hash(uint64_t o) {
62260         LDKRawBolt11Invoice o_conv;
62261         o_conv.inner = untag_ptr(o);
62262         o_conv.is_owned = ptr_is_owned(o);
62263         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62264         o_conv.is_owned = false;
62265         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
62266         return ret_conv;
62267 }
62268
62269 void  __attribute__((export_name("TS_RawDataPart_free"))) TS_RawDataPart_free(uint64_t this_obj) {
62270         LDKRawDataPart this_obj_conv;
62271         this_obj_conv.inner = untag_ptr(this_obj);
62272         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62274         RawDataPart_free(this_obj_conv);
62275 }
62276
62277 uint64_t  __attribute__((export_name("TS_RawDataPart_get_timestamp"))) TS_RawDataPart_get_timestamp(uint64_t this_ptr) {
62278         LDKRawDataPart this_ptr_conv;
62279         this_ptr_conv.inner = untag_ptr(this_ptr);
62280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62282         this_ptr_conv.is_owned = false;
62283         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
62284         uint64_t ret_ref = 0;
62285         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62286         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62287         return ret_ref;
62288 }
62289
62290 void  __attribute__((export_name("TS_RawDataPart_set_timestamp"))) TS_RawDataPart_set_timestamp(uint64_t this_ptr, uint64_t val) {
62291         LDKRawDataPart this_ptr_conv;
62292         this_ptr_conv.inner = untag_ptr(this_ptr);
62293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62295         this_ptr_conv.is_owned = false;
62296         LDKPositiveTimestamp val_conv;
62297         val_conv.inner = untag_ptr(val);
62298         val_conv.is_owned = ptr_is_owned(val);
62299         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62300         val_conv = PositiveTimestamp_clone(&val_conv);
62301         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
62302 }
62303
62304 jboolean  __attribute__((export_name("TS_RawDataPart_eq"))) TS_RawDataPart_eq(uint64_t a, uint64_t b) {
62305         LDKRawDataPart a_conv;
62306         a_conv.inner = untag_ptr(a);
62307         a_conv.is_owned = ptr_is_owned(a);
62308         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62309         a_conv.is_owned = false;
62310         LDKRawDataPart b_conv;
62311         b_conv.inner = untag_ptr(b);
62312         b_conv.is_owned = ptr_is_owned(b);
62313         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62314         b_conv.is_owned = false;
62315         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
62316         return ret_conv;
62317 }
62318
62319 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
62320         LDKRawDataPart ret_var = RawDataPart_clone(arg);
62321         uint64_t ret_ref = 0;
62322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62324         return ret_ref;
62325 }
62326 int64_t  __attribute__((export_name("TS_RawDataPart_clone_ptr"))) TS_RawDataPart_clone_ptr(uint64_t arg) {
62327         LDKRawDataPart arg_conv;
62328         arg_conv.inner = untag_ptr(arg);
62329         arg_conv.is_owned = ptr_is_owned(arg);
62330         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62331         arg_conv.is_owned = false;
62332         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
62333         return ret_conv;
62334 }
62335
62336 uint64_t  __attribute__((export_name("TS_RawDataPart_clone"))) TS_RawDataPart_clone(uint64_t orig) {
62337         LDKRawDataPart orig_conv;
62338         orig_conv.inner = untag_ptr(orig);
62339         orig_conv.is_owned = ptr_is_owned(orig);
62340         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62341         orig_conv.is_owned = false;
62342         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
62343         uint64_t ret_ref = 0;
62344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62346         return ret_ref;
62347 }
62348
62349 int64_t  __attribute__((export_name("TS_RawDataPart_hash"))) TS_RawDataPart_hash(uint64_t o) {
62350         LDKRawDataPart o_conv;
62351         o_conv.inner = untag_ptr(o);
62352         o_conv.is_owned = ptr_is_owned(o);
62353         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62354         o_conv.is_owned = false;
62355         int64_t ret_conv = RawDataPart_hash(&o_conv);
62356         return ret_conv;
62357 }
62358
62359 void  __attribute__((export_name("TS_PositiveTimestamp_free"))) TS_PositiveTimestamp_free(uint64_t this_obj) {
62360         LDKPositiveTimestamp this_obj_conv;
62361         this_obj_conv.inner = untag_ptr(this_obj);
62362         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62364         PositiveTimestamp_free(this_obj_conv);
62365 }
62366
62367 jboolean  __attribute__((export_name("TS_PositiveTimestamp_eq"))) TS_PositiveTimestamp_eq(uint64_t a, uint64_t b) {
62368         LDKPositiveTimestamp a_conv;
62369         a_conv.inner = untag_ptr(a);
62370         a_conv.is_owned = ptr_is_owned(a);
62371         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62372         a_conv.is_owned = false;
62373         LDKPositiveTimestamp b_conv;
62374         b_conv.inner = untag_ptr(b);
62375         b_conv.is_owned = ptr_is_owned(b);
62376         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62377         b_conv.is_owned = false;
62378         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
62379         return ret_conv;
62380 }
62381
62382 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
62383         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
62384         uint64_t ret_ref = 0;
62385         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62386         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62387         return ret_ref;
62388 }
62389 int64_t  __attribute__((export_name("TS_PositiveTimestamp_clone_ptr"))) TS_PositiveTimestamp_clone_ptr(uint64_t arg) {
62390         LDKPositiveTimestamp arg_conv;
62391         arg_conv.inner = untag_ptr(arg);
62392         arg_conv.is_owned = ptr_is_owned(arg);
62393         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62394         arg_conv.is_owned = false;
62395         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
62396         return ret_conv;
62397 }
62398
62399 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_clone"))) TS_PositiveTimestamp_clone(uint64_t orig) {
62400         LDKPositiveTimestamp orig_conv;
62401         orig_conv.inner = untag_ptr(orig);
62402         orig_conv.is_owned = ptr_is_owned(orig);
62403         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62404         orig_conv.is_owned = false;
62405         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
62406         uint64_t ret_ref = 0;
62407         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62408         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62409         return ret_ref;
62410 }
62411
62412 int64_t  __attribute__((export_name("TS_PositiveTimestamp_hash"))) TS_PositiveTimestamp_hash(uint64_t o) {
62413         LDKPositiveTimestamp o_conv;
62414         o_conv.inner = untag_ptr(o);
62415         o_conv.is_owned = ptr_is_owned(o);
62416         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62417         o_conv.is_owned = false;
62418         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
62419         return ret_conv;
62420 }
62421
62422 uint32_t  __attribute__((export_name("TS_SiPrefix_clone"))) TS_SiPrefix_clone(uint64_t orig) {
62423         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
62424         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_clone(orig_conv));
62425         return ret_conv;
62426 }
62427
62428 uint32_t  __attribute__((export_name("TS_SiPrefix_milli"))) TS_SiPrefix_milli() {
62429         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_milli());
62430         return ret_conv;
62431 }
62432
62433 uint32_t  __attribute__((export_name("TS_SiPrefix_micro"))) TS_SiPrefix_micro() {
62434         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_micro());
62435         return ret_conv;
62436 }
62437
62438 uint32_t  __attribute__((export_name("TS_SiPrefix_nano"))) TS_SiPrefix_nano() {
62439         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_nano());
62440         return ret_conv;
62441 }
62442
62443 uint32_t  __attribute__((export_name("TS_SiPrefix_pico"))) TS_SiPrefix_pico() {
62444         uint32_t ret_conv = LDKSiPrefix_to_js(SiPrefix_pico());
62445         return ret_conv;
62446 }
62447
62448 jboolean  __attribute__((export_name("TS_SiPrefix_eq"))) TS_SiPrefix_eq(uint64_t a, uint64_t b) {
62449         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
62450         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
62451         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
62452         return ret_conv;
62453 }
62454
62455 int64_t  __attribute__((export_name("TS_SiPrefix_hash"))) TS_SiPrefix_hash(uint64_t o) {
62456         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
62457         int64_t ret_conv = SiPrefix_hash(o_conv);
62458         return ret_conv;
62459 }
62460
62461 int64_t  __attribute__((export_name("TS_SiPrefix_multiplier"))) TS_SiPrefix_multiplier(uint64_t this_arg) {
62462         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
62463         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
62464         return ret_conv;
62465 }
62466
62467 uint32_t  __attribute__((export_name("TS_Currency_clone"))) TS_Currency_clone(uint64_t orig) {
62468         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
62469         uint32_t ret_conv = LDKCurrency_to_js(Currency_clone(orig_conv));
62470         return ret_conv;
62471 }
62472
62473 uint32_t  __attribute__((export_name("TS_Currency_bitcoin"))) TS_Currency_bitcoin() {
62474         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin());
62475         return ret_conv;
62476 }
62477
62478 uint32_t  __attribute__((export_name("TS_Currency_bitcoin_testnet"))) TS_Currency_bitcoin_testnet() {
62479         uint32_t ret_conv = LDKCurrency_to_js(Currency_bitcoin_testnet());
62480         return ret_conv;
62481 }
62482
62483 uint32_t  __attribute__((export_name("TS_Currency_regtest"))) TS_Currency_regtest() {
62484         uint32_t ret_conv = LDKCurrency_to_js(Currency_regtest());
62485         return ret_conv;
62486 }
62487
62488 uint32_t  __attribute__((export_name("TS_Currency_simnet"))) TS_Currency_simnet() {
62489         uint32_t ret_conv = LDKCurrency_to_js(Currency_simnet());
62490         return ret_conv;
62491 }
62492
62493 uint32_t  __attribute__((export_name("TS_Currency_signet"))) TS_Currency_signet() {
62494         uint32_t ret_conv = LDKCurrency_to_js(Currency_signet());
62495         return ret_conv;
62496 }
62497
62498 int64_t  __attribute__((export_name("TS_Currency_hash"))) TS_Currency_hash(uint64_t o) {
62499         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
62500         int64_t ret_conv = Currency_hash(o_conv);
62501         return ret_conv;
62502 }
62503
62504 jboolean  __attribute__((export_name("TS_Currency_eq"))) TS_Currency_eq(uint64_t a, uint64_t b) {
62505         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
62506         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
62507         jboolean ret_conv = Currency_eq(a_conv, b_conv);
62508         return ret_conv;
62509 }
62510
62511 void  __attribute__((export_name("TS_Sha256_free"))) TS_Sha256_free(uint64_t this_obj) {
62512         LDKSha256 this_obj_conv;
62513         this_obj_conv.inner = untag_ptr(this_obj);
62514         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62516         Sha256_free(this_obj_conv);
62517 }
62518
62519 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
62520         LDKSha256 ret_var = Sha256_clone(arg);
62521         uint64_t ret_ref = 0;
62522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62524         return ret_ref;
62525 }
62526 int64_t  __attribute__((export_name("TS_Sha256_clone_ptr"))) TS_Sha256_clone_ptr(uint64_t arg) {
62527         LDKSha256 arg_conv;
62528         arg_conv.inner = untag_ptr(arg);
62529         arg_conv.is_owned = ptr_is_owned(arg);
62530         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62531         arg_conv.is_owned = false;
62532         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
62533         return ret_conv;
62534 }
62535
62536 uint64_t  __attribute__((export_name("TS_Sha256_clone"))) TS_Sha256_clone(uint64_t orig) {
62537         LDKSha256 orig_conv;
62538         orig_conv.inner = untag_ptr(orig);
62539         orig_conv.is_owned = ptr_is_owned(orig);
62540         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62541         orig_conv.is_owned = false;
62542         LDKSha256 ret_var = Sha256_clone(&orig_conv);
62543         uint64_t ret_ref = 0;
62544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62546         return ret_ref;
62547 }
62548
62549 int64_t  __attribute__((export_name("TS_Sha256_hash"))) TS_Sha256_hash(uint64_t o) {
62550         LDKSha256 o_conv;
62551         o_conv.inner = untag_ptr(o);
62552         o_conv.is_owned = ptr_is_owned(o);
62553         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62554         o_conv.is_owned = false;
62555         int64_t ret_conv = Sha256_hash(&o_conv);
62556         return ret_conv;
62557 }
62558
62559 jboolean  __attribute__((export_name("TS_Sha256_eq"))) TS_Sha256_eq(uint64_t a, uint64_t b) {
62560         LDKSha256 a_conv;
62561         a_conv.inner = untag_ptr(a);
62562         a_conv.is_owned = ptr_is_owned(a);
62563         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62564         a_conv.is_owned = false;
62565         LDKSha256 b_conv;
62566         b_conv.inner = untag_ptr(b);
62567         b_conv.is_owned = ptr_is_owned(b);
62568         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62569         b_conv.is_owned = false;
62570         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
62571         return ret_conv;
62572 }
62573
62574 uint64_t  __attribute__((export_name("TS_Sha256_from_bytes"))) TS_Sha256_from_bytes(int8_tArray bytes) {
62575         uint8_t bytes_arr[32];
62576         CHECK(bytes->arr_len == 32);
62577         memcpy(bytes_arr, bytes->elems, 32); FREE(bytes);
62578         uint8_t (*bytes_ref)[32] = &bytes_arr;
62579         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
62580         uint64_t ret_ref = 0;
62581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62583         return ret_ref;
62584 }
62585
62586 void  __attribute__((export_name("TS_Description_free"))) TS_Description_free(uint64_t this_obj) {
62587         LDKDescription this_obj_conv;
62588         this_obj_conv.inner = untag_ptr(this_obj);
62589         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62590         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62591         Description_free(this_obj_conv);
62592 }
62593
62594 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
62595         LDKDescription ret_var = Description_clone(arg);
62596         uint64_t ret_ref = 0;
62597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62599         return ret_ref;
62600 }
62601 int64_t  __attribute__((export_name("TS_Description_clone_ptr"))) TS_Description_clone_ptr(uint64_t arg) {
62602         LDKDescription arg_conv;
62603         arg_conv.inner = untag_ptr(arg);
62604         arg_conv.is_owned = ptr_is_owned(arg);
62605         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62606         arg_conv.is_owned = false;
62607         int64_t ret_conv = Description_clone_ptr(&arg_conv);
62608         return ret_conv;
62609 }
62610
62611 uint64_t  __attribute__((export_name("TS_Description_clone"))) TS_Description_clone(uint64_t orig) {
62612         LDKDescription orig_conv;
62613         orig_conv.inner = untag_ptr(orig);
62614         orig_conv.is_owned = ptr_is_owned(orig);
62615         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62616         orig_conv.is_owned = false;
62617         LDKDescription ret_var = Description_clone(&orig_conv);
62618         uint64_t ret_ref = 0;
62619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62621         return ret_ref;
62622 }
62623
62624 int64_t  __attribute__((export_name("TS_Description_hash"))) TS_Description_hash(uint64_t o) {
62625         LDKDescription o_conv;
62626         o_conv.inner = untag_ptr(o);
62627         o_conv.is_owned = ptr_is_owned(o);
62628         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62629         o_conv.is_owned = false;
62630         int64_t ret_conv = Description_hash(&o_conv);
62631         return ret_conv;
62632 }
62633
62634 jboolean  __attribute__((export_name("TS_Description_eq"))) TS_Description_eq(uint64_t a, uint64_t b) {
62635         LDKDescription a_conv;
62636         a_conv.inner = untag_ptr(a);
62637         a_conv.is_owned = ptr_is_owned(a);
62638         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62639         a_conv.is_owned = false;
62640         LDKDescription b_conv;
62641         b_conv.inner = untag_ptr(b);
62642         b_conv.is_owned = ptr_is_owned(b);
62643         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62644         b_conv.is_owned = false;
62645         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
62646         return ret_conv;
62647 }
62648
62649 void  __attribute__((export_name("TS_PayeePubKey_free"))) TS_PayeePubKey_free(uint64_t this_obj) {
62650         LDKPayeePubKey this_obj_conv;
62651         this_obj_conv.inner = untag_ptr(this_obj);
62652         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62654         PayeePubKey_free(this_obj_conv);
62655 }
62656
62657 int8_tArray  __attribute__((export_name("TS_PayeePubKey_get_a"))) TS_PayeePubKey_get_a(uint64_t this_ptr) {
62658         LDKPayeePubKey this_ptr_conv;
62659         this_ptr_conv.inner = untag_ptr(this_ptr);
62660         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62661         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62662         this_ptr_conv.is_owned = false;
62663         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
62664         memcpy(ret_arr->elems, PayeePubKey_get_a(&this_ptr_conv).compressed_form, 33);
62665         return ret_arr;
62666 }
62667
62668 void  __attribute__((export_name("TS_PayeePubKey_set_a"))) TS_PayeePubKey_set_a(uint64_t this_ptr, int8_tArray val) {
62669         LDKPayeePubKey this_ptr_conv;
62670         this_ptr_conv.inner = untag_ptr(this_ptr);
62671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62673         this_ptr_conv.is_owned = false;
62674         LDKPublicKey val_ref;
62675         CHECK(val->arr_len == 33);
62676         memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
62677         PayeePubKey_set_a(&this_ptr_conv, val_ref);
62678 }
62679
62680 uint64_t  __attribute__((export_name("TS_PayeePubKey_new"))) TS_PayeePubKey_new(int8_tArray a_arg) {
62681         LDKPublicKey a_arg_ref;
62682         CHECK(a_arg->arr_len == 33);
62683         memcpy(a_arg_ref.compressed_form, a_arg->elems, 33); FREE(a_arg);
62684         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
62685         uint64_t ret_ref = 0;
62686         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62687         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62688         return ret_ref;
62689 }
62690
62691 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
62692         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
62693         uint64_t ret_ref = 0;
62694         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62695         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62696         return ret_ref;
62697 }
62698 int64_t  __attribute__((export_name("TS_PayeePubKey_clone_ptr"))) TS_PayeePubKey_clone_ptr(uint64_t arg) {
62699         LDKPayeePubKey arg_conv;
62700         arg_conv.inner = untag_ptr(arg);
62701         arg_conv.is_owned = ptr_is_owned(arg);
62702         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62703         arg_conv.is_owned = false;
62704         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
62705         return ret_conv;
62706 }
62707
62708 uint64_t  __attribute__((export_name("TS_PayeePubKey_clone"))) TS_PayeePubKey_clone(uint64_t orig) {
62709         LDKPayeePubKey orig_conv;
62710         orig_conv.inner = untag_ptr(orig);
62711         orig_conv.is_owned = ptr_is_owned(orig);
62712         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62713         orig_conv.is_owned = false;
62714         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
62715         uint64_t ret_ref = 0;
62716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62718         return ret_ref;
62719 }
62720
62721 int64_t  __attribute__((export_name("TS_PayeePubKey_hash"))) TS_PayeePubKey_hash(uint64_t o) {
62722         LDKPayeePubKey o_conv;
62723         o_conv.inner = untag_ptr(o);
62724         o_conv.is_owned = ptr_is_owned(o);
62725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62726         o_conv.is_owned = false;
62727         int64_t ret_conv = PayeePubKey_hash(&o_conv);
62728         return ret_conv;
62729 }
62730
62731 jboolean  __attribute__((export_name("TS_PayeePubKey_eq"))) TS_PayeePubKey_eq(uint64_t a, uint64_t b) {
62732         LDKPayeePubKey a_conv;
62733         a_conv.inner = untag_ptr(a);
62734         a_conv.is_owned = ptr_is_owned(a);
62735         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62736         a_conv.is_owned = false;
62737         LDKPayeePubKey b_conv;
62738         b_conv.inner = untag_ptr(b);
62739         b_conv.is_owned = ptr_is_owned(b);
62740         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62741         b_conv.is_owned = false;
62742         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
62743         return ret_conv;
62744 }
62745
62746 void  __attribute__((export_name("TS_ExpiryTime_free"))) TS_ExpiryTime_free(uint64_t this_obj) {
62747         LDKExpiryTime this_obj_conv;
62748         this_obj_conv.inner = untag_ptr(this_obj);
62749         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62751         ExpiryTime_free(this_obj_conv);
62752 }
62753
62754 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
62755         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
62756         uint64_t ret_ref = 0;
62757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62759         return ret_ref;
62760 }
62761 int64_t  __attribute__((export_name("TS_ExpiryTime_clone_ptr"))) TS_ExpiryTime_clone_ptr(uint64_t arg) {
62762         LDKExpiryTime arg_conv;
62763         arg_conv.inner = untag_ptr(arg);
62764         arg_conv.is_owned = ptr_is_owned(arg);
62765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62766         arg_conv.is_owned = false;
62767         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
62768         return ret_conv;
62769 }
62770
62771 uint64_t  __attribute__((export_name("TS_ExpiryTime_clone"))) TS_ExpiryTime_clone(uint64_t orig) {
62772         LDKExpiryTime orig_conv;
62773         orig_conv.inner = untag_ptr(orig);
62774         orig_conv.is_owned = ptr_is_owned(orig);
62775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62776         orig_conv.is_owned = false;
62777         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
62778         uint64_t ret_ref = 0;
62779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62781         return ret_ref;
62782 }
62783
62784 int64_t  __attribute__((export_name("TS_ExpiryTime_hash"))) TS_ExpiryTime_hash(uint64_t o) {
62785         LDKExpiryTime o_conv;
62786         o_conv.inner = untag_ptr(o);
62787         o_conv.is_owned = ptr_is_owned(o);
62788         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62789         o_conv.is_owned = false;
62790         int64_t ret_conv = ExpiryTime_hash(&o_conv);
62791         return ret_conv;
62792 }
62793
62794 jboolean  __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint64_t a, uint64_t b) {
62795         LDKExpiryTime a_conv;
62796         a_conv.inner = untag_ptr(a);
62797         a_conv.is_owned = ptr_is_owned(a);
62798         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62799         a_conv.is_owned = false;
62800         LDKExpiryTime b_conv;
62801         b_conv.inner = untag_ptr(b);
62802         b_conv.is_owned = ptr_is_owned(b);
62803         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62804         b_conv.is_owned = false;
62805         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
62806         return ret_conv;
62807 }
62808
62809 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) {
62810         LDKMinFinalCltvExpiryDelta this_obj_conv;
62811         this_obj_conv.inner = untag_ptr(this_obj);
62812         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62814         MinFinalCltvExpiryDelta_free(this_obj_conv);
62815 }
62816
62817 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) {
62818         LDKMinFinalCltvExpiryDelta this_ptr_conv;
62819         this_ptr_conv.inner = untag_ptr(this_ptr);
62820         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62821         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62822         this_ptr_conv.is_owned = false;
62823         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
62824         return ret_conv;
62825 }
62826
62827 void  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) {
62828         LDKMinFinalCltvExpiryDelta this_ptr_conv;
62829         this_ptr_conv.inner = untag_ptr(this_ptr);
62830         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62832         this_ptr_conv.is_owned = false;
62833         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
62834 }
62835
62836 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) {
62837         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
62838         uint64_t ret_ref = 0;
62839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62841         return ret_ref;
62842 }
62843
62844 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
62845         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
62846         uint64_t ret_ref = 0;
62847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62849         return ret_ref;
62850 }
62851 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) {
62852         LDKMinFinalCltvExpiryDelta arg_conv;
62853         arg_conv.inner = untag_ptr(arg);
62854         arg_conv.is_owned = ptr_is_owned(arg);
62855         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62856         arg_conv.is_owned = false;
62857         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
62858         return ret_conv;
62859 }
62860
62861 uint64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) {
62862         LDKMinFinalCltvExpiryDelta orig_conv;
62863         orig_conv.inner = untag_ptr(orig);
62864         orig_conv.is_owned = ptr_is_owned(orig);
62865         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62866         orig_conv.is_owned = false;
62867         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
62868         uint64_t ret_ref = 0;
62869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62871         return ret_ref;
62872 }
62873
62874 int64_t  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) {
62875         LDKMinFinalCltvExpiryDelta o_conv;
62876         o_conv.inner = untag_ptr(o);
62877         o_conv.is_owned = ptr_is_owned(o);
62878         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
62879         o_conv.is_owned = false;
62880         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
62881         return ret_conv;
62882 }
62883
62884 jboolean  __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) {
62885         LDKMinFinalCltvExpiryDelta a_conv;
62886         a_conv.inner = untag_ptr(a);
62887         a_conv.is_owned = ptr_is_owned(a);
62888         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62889         a_conv.is_owned = false;
62890         LDKMinFinalCltvExpiryDelta b_conv;
62891         b_conv.inner = untag_ptr(b);
62892         b_conv.is_owned = ptr_is_owned(b);
62893         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62894         b_conv.is_owned = false;
62895         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
62896         return ret_conv;
62897 }
62898
62899 void  __attribute__((export_name("TS_Fallback_free"))) TS_Fallback_free(uint64_t this_ptr) {
62900         if (!ptr_is_owned(this_ptr)) return;
62901         void* this_ptr_ptr = untag_ptr(this_ptr);
62902         CHECK_ACCESS(this_ptr_ptr);
62903         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
62904         FREE(untag_ptr(this_ptr));
62905         Fallback_free(this_ptr_conv);
62906 }
62907
62908 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
62909         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62910         *ret_copy = Fallback_clone(arg);
62911         uint64_t ret_ref = tag_ptr(ret_copy, true);
62912         return ret_ref;
62913 }
62914 int64_t  __attribute__((export_name("TS_Fallback_clone_ptr"))) TS_Fallback_clone_ptr(uint64_t arg) {
62915         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
62916         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
62917         return ret_conv;
62918 }
62919
62920 uint64_t  __attribute__((export_name("TS_Fallback_clone"))) TS_Fallback_clone(uint64_t orig) {
62921         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
62922         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62923         *ret_copy = Fallback_clone(orig_conv);
62924         uint64_t ret_ref = tag_ptr(ret_copy, true);
62925         return ret_ref;
62926 }
62927
62928 uint64_t  __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallback_seg_wit_program(int8_t version, int8_tArray program) {
62929         
62930         LDKCVec_u8Z program_ref;
62931         program_ref.datalen = program->arr_len;
62932         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
62933         memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program);
62934         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62935         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
62936         uint64_t ret_ref = tag_ptr(ret_copy, true);
62937         return ret_ref;
62938 }
62939
62940 uint64_t  __attribute__((export_name("TS_Fallback_pub_key_hash"))) TS_Fallback_pub_key_hash(int8_tArray a) {
62941         LDKTwentyBytes a_ref;
62942         CHECK(a->arr_len == 20);
62943         memcpy(a_ref.data, a->elems, 20); FREE(a);
62944         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62945         *ret_copy = Fallback_pub_key_hash(a_ref);
62946         uint64_t ret_ref = tag_ptr(ret_copy, true);
62947         return ret_ref;
62948 }
62949
62950 uint64_t  __attribute__((export_name("TS_Fallback_script_hash"))) TS_Fallback_script_hash(int8_tArray a) {
62951         LDKTwentyBytes a_ref;
62952         CHECK(a->arr_len == 20);
62953         memcpy(a_ref.data, a->elems, 20); FREE(a);
62954         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
62955         *ret_copy = Fallback_script_hash(a_ref);
62956         uint64_t ret_ref = tag_ptr(ret_copy, true);
62957         return ret_ref;
62958 }
62959
62960 int64_t  __attribute__((export_name("TS_Fallback_hash"))) TS_Fallback_hash(uint64_t o) {
62961         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
62962         int64_t ret_conv = Fallback_hash(o_conv);
62963         return ret_conv;
62964 }
62965
62966 jboolean  __attribute__((export_name("TS_Fallback_eq"))) TS_Fallback_eq(uint64_t a, uint64_t b) {
62967         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
62968         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
62969         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
62970         return ret_conv;
62971 }
62972
62973 void  __attribute__((export_name("TS_Bolt11InvoiceSignature_free"))) TS_Bolt11InvoiceSignature_free(uint64_t this_obj) {
62974         LDKBolt11InvoiceSignature this_obj_conv;
62975         this_obj_conv.inner = untag_ptr(this_obj);
62976         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62978         Bolt11InvoiceSignature_free(this_obj_conv);
62979 }
62980
62981 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
62982         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
62983         uint64_t ret_ref = 0;
62984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62986         return ret_ref;
62987 }
62988 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone_ptr"))) TS_Bolt11InvoiceSignature_clone_ptr(uint64_t arg) {
62989         LDKBolt11InvoiceSignature arg_conv;
62990         arg_conv.inner = untag_ptr(arg);
62991         arg_conv.is_owned = ptr_is_owned(arg);
62992         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62993         arg_conv.is_owned = false;
62994         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
62995         return ret_conv;
62996 }
62997
62998 uint64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_clone"))) TS_Bolt11InvoiceSignature_clone(uint64_t orig) {
62999         LDKBolt11InvoiceSignature orig_conv;
63000         orig_conv.inner = untag_ptr(orig);
63001         orig_conv.is_owned = ptr_is_owned(orig);
63002         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63003         orig_conv.is_owned = false;
63004         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
63005         uint64_t ret_ref = 0;
63006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63008         return ret_ref;
63009 }
63010
63011 int64_t  __attribute__((export_name("TS_Bolt11InvoiceSignature_hash"))) TS_Bolt11InvoiceSignature_hash(uint64_t o) {
63012         LDKBolt11InvoiceSignature o_conv;
63013         o_conv.inner = untag_ptr(o);
63014         o_conv.is_owned = ptr_is_owned(o);
63015         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63016         o_conv.is_owned = false;
63017         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
63018         return ret_conv;
63019 }
63020
63021 jboolean  __attribute__((export_name("TS_Bolt11InvoiceSignature_eq"))) TS_Bolt11InvoiceSignature_eq(uint64_t a, uint64_t b) {
63022         LDKBolt11InvoiceSignature a_conv;
63023         a_conv.inner = untag_ptr(a);
63024         a_conv.is_owned = ptr_is_owned(a);
63025         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63026         a_conv.is_owned = false;
63027         LDKBolt11InvoiceSignature b_conv;
63028         b_conv.inner = untag_ptr(b);
63029         b_conv.is_owned = ptr_is_owned(b);
63030         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63031         b_conv.is_owned = false;
63032         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
63033         return ret_conv;
63034 }
63035
63036 void  __attribute__((export_name("TS_PrivateRoute_free"))) TS_PrivateRoute_free(uint64_t this_obj) {
63037         LDKPrivateRoute this_obj_conv;
63038         this_obj_conv.inner = untag_ptr(this_obj);
63039         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63040         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63041         PrivateRoute_free(this_obj_conv);
63042 }
63043
63044 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
63045         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
63046         uint64_t ret_ref = 0;
63047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63049         return ret_ref;
63050 }
63051 int64_t  __attribute__((export_name("TS_PrivateRoute_clone_ptr"))) TS_PrivateRoute_clone_ptr(uint64_t arg) {
63052         LDKPrivateRoute arg_conv;
63053         arg_conv.inner = untag_ptr(arg);
63054         arg_conv.is_owned = ptr_is_owned(arg);
63055         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63056         arg_conv.is_owned = false;
63057         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
63058         return ret_conv;
63059 }
63060
63061 uint64_t  __attribute__((export_name("TS_PrivateRoute_clone"))) TS_PrivateRoute_clone(uint64_t orig) {
63062         LDKPrivateRoute orig_conv;
63063         orig_conv.inner = untag_ptr(orig);
63064         orig_conv.is_owned = ptr_is_owned(orig);
63065         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63066         orig_conv.is_owned = false;
63067         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
63068         uint64_t ret_ref = 0;
63069         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63070         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63071         return ret_ref;
63072 }
63073
63074 int64_t  __attribute__((export_name("TS_PrivateRoute_hash"))) TS_PrivateRoute_hash(uint64_t o) {
63075         LDKPrivateRoute o_conv;
63076         o_conv.inner = untag_ptr(o);
63077         o_conv.is_owned = ptr_is_owned(o);
63078         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63079         o_conv.is_owned = false;
63080         int64_t ret_conv = PrivateRoute_hash(&o_conv);
63081         return ret_conv;
63082 }
63083
63084 jboolean  __attribute__((export_name("TS_PrivateRoute_eq"))) TS_PrivateRoute_eq(uint64_t a, uint64_t b) {
63085         LDKPrivateRoute a_conv;
63086         a_conv.inner = untag_ptr(a);
63087         a_conv.is_owned = ptr_is_owned(a);
63088         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63089         a_conv.is_owned = false;
63090         LDKPrivateRoute b_conv;
63091         b_conv.inner = untag_ptr(b);
63092         b_conv.is_owned = ptr_is_owned(b);
63093         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63094         b_conv.is_owned = false;
63095         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
63096         return ret_conv;
63097 }
63098
63099 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_into_parts"))) TS_SignedRawBolt11Invoice_into_parts(uint64_t this_arg) {
63100         LDKSignedRawBolt11Invoice this_arg_conv;
63101         this_arg_conv.inner = untag_ptr(this_arg);
63102         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63104         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
63105         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
63106         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
63107         return tag_ptr(ret_conv, true);
63108 }
63109
63110 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_raw_invoice"))) TS_SignedRawBolt11Invoice_raw_invoice(uint64_t this_arg) {
63111         LDKSignedRawBolt11Invoice this_arg_conv;
63112         this_arg_conv.inner = untag_ptr(this_arg);
63113         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63115         this_arg_conv.is_owned = false;
63116         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
63117         uint64_t ret_ref = 0;
63118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63120         return ret_ref;
63121 }
63122
63123 int8_tArray  __attribute__((export_name("TS_SignedRawBolt11Invoice_signable_hash"))) TS_SignedRawBolt11Invoice_signable_hash(uint64_t this_arg) {
63124         LDKSignedRawBolt11Invoice this_arg_conv;
63125         this_arg_conv.inner = untag_ptr(this_arg);
63126         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63128         this_arg_conv.is_owned = false;
63129         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63130         memcpy(ret_arr->elems, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv), 32);
63131         return ret_arr;
63132 }
63133
63134 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_signature"))) TS_SignedRawBolt11Invoice_signature(uint64_t this_arg) {
63135         LDKSignedRawBolt11Invoice this_arg_conv;
63136         this_arg_conv.inner = untag_ptr(this_arg);
63137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63139         this_arg_conv.is_owned = false;
63140         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
63141         uint64_t ret_ref = 0;
63142         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63143         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63144         return ret_ref;
63145 }
63146
63147 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_recover_payee_pub_key"))) TS_SignedRawBolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
63148         LDKSignedRawBolt11Invoice this_arg_conv;
63149         this_arg_conv.inner = untag_ptr(this_arg);
63150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63152         this_arg_conv.is_owned = false;
63153         LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
63154         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
63155         return tag_ptr(ret_conv, true);
63156 }
63157
63158 jboolean  __attribute__((export_name("TS_SignedRawBolt11Invoice_check_signature"))) TS_SignedRawBolt11Invoice_check_signature(uint64_t this_arg) {
63159         LDKSignedRawBolt11Invoice this_arg_conv;
63160         this_arg_conv.inner = untag_ptr(this_arg);
63161         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63163         this_arg_conv.is_owned = false;
63164         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
63165         return ret_conv;
63166 }
63167
63168 int8_tArray  __attribute__((export_name("TS_RawBolt11Invoice_signable_hash"))) TS_RawBolt11Invoice_signable_hash(uint64_t this_arg) {
63169         LDKRawBolt11Invoice this_arg_conv;
63170         this_arg_conv.inner = untag_ptr(this_arg);
63171         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63173         this_arg_conv.is_owned = false;
63174         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63175         memcpy(ret_arr->elems, RawBolt11Invoice_signable_hash(&this_arg_conv).data, 32);
63176         return ret_arr;
63177 }
63178
63179 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_hash"))) TS_RawBolt11Invoice_payment_hash(uint64_t this_arg) {
63180         LDKRawBolt11Invoice this_arg_conv;
63181         this_arg_conv.inner = untag_ptr(this_arg);
63182         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63183         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63184         this_arg_conv.is_owned = false;
63185         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
63186         uint64_t ret_ref = 0;
63187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63189         return ret_ref;
63190 }
63191
63192 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description"))) TS_RawBolt11Invoice_description(uint64_t this_arg) {
63193         LDKRawBolt11Invoice this_arg_conv;
63194         this_arg_conv.inner = untag_ptr(this_arg);
63195         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63197         this_arg_conv.is_owned = false;
63198         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
63199         uint64_t ret_ref = 0;
63200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63202         return ret_ref;
63203 }
63204
63205 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payee_pub_key"))) TS_RawBolt11Invoice_payee_pub_key(uint64_t this_arg) {
63206         LDKRawBolt11Invoice this_arg_conv;
63207         this_arg_conv.inner = untag_ptr(this_arg);
63208         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63210         this_arg_conv.is_owned = false;
63211         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
63212         uint64_t ret_ref = 0;
63213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63215         return ret_ref;
63216 }
63217
63218 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_description_hash"))) TS_RawBolt11Invoice_description_hash(uint64_t this_arg) {
63219         LDKRawBolt11Invoice this_arg_conv;
63220         this_arg_conv.inner = untag_ptr(this_arg);
63221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63223         this_arg_conv.is_owned = false;
63224         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
63225         uint64_t ret_ref = 0;
63226         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63227         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63228         return ret_ref;
63229 }
63230
63231 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_expiry_time"))) TS_RawBolt11Invoice_expiry_time(uint64_t this_arg) {
63232         LDKRawBolt11Invoice this_arg_conv;
63233         this_arg_conv.inner = untag_ptr(this_arg);
63234         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63235         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63236         this_arg_conv.is_owned = false;
63237         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
63238         uint64_t ret_ref = 0;
63239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63241         return ret_ref;
63242 }
63243
63244 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_min_final_cltv_expiry_delta"))) TS_RawBolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
63245         LDKRawBolt11Invoice this_arg_conv;
63246         this_arg_conv.inner = untag_ptr(this_arg);
63247         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63248         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63249         this_arg_conv.is_owned = false;
63250         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
63251         uint64_t ret_ref = 0;
63252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63254         return ret_ref;
63255 }
63256
63257 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_secret"))) TS_RawBolt11Invoice_payment_secret(uint64_t this_arg) {
63258         LDKRawBolt11Invoice this_arg_conv;
63259         this_arg_conv.inner = untag_ptr(this_arg);
63260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63262         this_arg_conv.is_owned = false;
63263         LDKCOption_PaymentSecretZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentSecretZ), "LDKCOption_PaymentSecretZ");
63264         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
63265         uint64_t ret_ref = tag_ptr(ret_copy, true);
63266         return ret_ref;
63267 }
63268
63269 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_payment_metadata"))) TS_RawBolt11Invoice_payment_metadata(uint64_t this_arg) {
63270         LDKRawBolt11Invoice this_arg_conv;
63271         this_arg_conv.inner = untag_ptr(this_arg);
63272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63274         this_arg_conv.is_owned = false;
63275         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
63276         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
63277         uint64_t ret_ref = tag_ptr(ret_copy, true);
63278         return ret_ref;
63279 }
63280
63281 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_features"))) TS_RawBolt11Invoice_features(uint64_t this_arg) {
63282         LDKRawBolt11Invoice this_arg_conv;
63283         this_arg_conv.inner = untag_ptr(this_arg);
63284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63286         this_arg_conv.is_owned = false;
63287         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
63288         uint64_t ret_ref = 0;
63289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63290         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63291         return ret_ref;
63292 }
63293
63294 uint64_tArray  __attribute__((export_name("TS_RawBolt11Invoice_private_routes"))) TS_RawBolt11Invoice_private_routes(uint64_t this_arg) {
63295         LDKRawBolt11Invoice this_arg_conv;
63296         this_arg_conv.inner = untag_ptr(this_arg);
63297         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63298         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63299         this_arg_conv.is_owned = false;
63300         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
63301         uint64_tArray ret_arr = NULL;
63302         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63303         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63304         for (size_t o = 0; o < ret_var.datalen; o++) {
63305                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
63306                 uint64_t ret_conv_14_ref = 0;
63307                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
63308                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
63309                 ret_arr_ptr[o] = ret_conv_14_ref;
63310         }
63311         
63312         FREE(ret_var.data);
63313         return ret_arr;
63314 }
63315
63316 uint64_t  __attribute__((export_name("TS_RawBolt11Invoice_amount_pico_btc"))) TS_RawBolt11Invoice_amount_pico_btc(uint64_t this_arg) {
63317         LDKRawBolt11Invoice this_arg_conv;
63318         this_arg_conv.inner = untag_ptr(this_arg);
63319         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63321         this_arg_conv.is_owned = false;
63322         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63323         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
63324         uint64_t ret_ref = tag_ptr(ret_copy, true);
63325         return ret_ref;
63326 }
63327
63328 uint32_t  __attribute__((export_name("TS_RawBolt11Invoice_currency"))) TS_RawBolt11Invoice_currency(uint64_t this_arg) {
63329         LDKRawBolt11Invoice this_arg_conv;
63330         this_arg_conv.inner = untag_ptr(this_arg);
63331         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63333         this_arg_conv.is_owned = false;
63334         uint32_t ret_conv = LDKCurrency_to_js(RawBolt11Invoice_currency(&this_arg_conv));
63335         return ret_conv;
63336 }
63337
63338 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_unix_timestamp"))) TS_PositiveTimestamp_from_unix_timestamp(int64_t unix_seconds) {
63339         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
63340         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
63341         return tag_ptr(ret_conv, true);
63342 }
63343
63344 uint64_t  __attribute__((export_name("TS_PositiveTimestamp_from_duration_since_epoch"))) TS_PositiveTimestamp_from_duration_since_epoch(int64_t duration) {
63345         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
63346         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
63347         return tag_ptr(ret_conv, true);
63348 }
63349
63350 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_unix_timestamp"))) TS_PositiveTimestamp_as_unix_timestamp(uint64_t this_arg) {
63351         LDKPositiveTimestamp this_arg_conv;
63352         this_arg_conv.inner = untag_ptr(this_arg);
63353         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63354         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63355         this_arg_conv.is_owned = false;
63356         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
63357         return ret_conv;
63358 }
63359
63360 int64_t  __attribute__((export_name("TS_PositiveTimestamp_as_duration_since_epoch"))) TS_PositiveTimestamp_as_duration_since_epoch(uint64_t this_arg) {
63361         LDKPositiveTimestamp this_arg_conv;
63362         this_arg_conv.inner = untag_ptr(this_arg);
63363         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63364         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63365         this_arg_conv.is_owned = false;
63366         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
63367         return ret_conv;
63368 }
63369
63370 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_signable_hash"))) TS_Bolt11Invoice_signable_hash(uint64_t this_arg) {
63371         LDKBolt11Invoice this_arg_conv;
63372         this_arg_conv.inner = untag_ptr(this_arg);
63373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63375         this_arg_conv.is_owned = false;
63376         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63377         memcpy(ret_arr->elems, Bolt11Invoice_signable_hash(&this_arg_conv).data, 32);
63378         return ret_arr;
63379 }
63380
63381 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_into_signed_raw"))) TS_Bolt11Invoice_into_signed_raw(uint64_t this_arg) {
63382         LDKBolt11Invoice this_arg_conv;
63383         this_arg_conv.inner = untag_ptr(this_arg);
63384         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63386         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
63387         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
63388         uint64_t ret_ref = 0;
63389         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63390         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63391         return ret_ref;
63392 }
63393
63394 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_check_signature"))) TS_Bolt11Invoice_check_signature(uint64_t this_arg) {
63395         LDKBolt11Invoice this_arg_conv;
63396         this_arg_conv.inner = untag_ptr(this_arg);
63397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63399         this_arg_conv.is_owned = false;
63400         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
63401         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
63402         return tag_ptr(ret_conv, true);
63403 }
63404
63405 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_signed"))) TS_Bolt11Invoice_from_signed(uint64_t signed_invoice) {
63406         LDKSignedRawBolt11Invoice signed_invoice_conv;
63407         signed_invoice_conv.inner = untag_ptr(signed_invoice);
63408         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
63409         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
63410         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
63411         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
63412         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
63413         return tag_ptr(ret_conv, true);
63414 }
63415
63416 int64_t  __attribute__((export_name("TS_Bolt11Invoice_duration_since_epoch"))) TS_Bolt11Invoice_duration_since_epoch(uint64_t this_arg) {
63417         LDKBolt11Invoice this_arg_conv;
63418         this_arg_conv.inner = untag_ptr(this_arg);
63419         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63421         this_arg_conv.is_owned = false;
63422         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
63423         return ret_conv;
63424 }
63425
63426 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_hash"))) TS_Bolt11Invoice_payment_hash(uint64_t this_arg) {
63427         LDKBolt11Invoice this_arg_conv;
63428         this_arg_conv.inner = untag_ptr(this_arg);
63429         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63431         this_arg_conv.is_owned = false;
63432         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63433         memcpy(ret_arr->elems, *Bolt11Invoice_payment_hash(&this_arg_conv), 32);
63434         return ret_arr;
63435 }
63436
63437 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payee_pub_key"))) TS_Bolt11Invoice_payee_pub_key(uint64_t this_arg) {
63438         LDKBolt11Invoice this_arg_conv;
63439         this_arg_conv.inner = untag_ptr(this_arg);
63440         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63442         this_arg_conv.is_owned = false;
63443         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63444         memcpy(ret_arr->elems, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form, 33);
63445         return ret_arr;
63446 }
63447
63448 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_payment_secret"))) TS_Bolt11Invoice_payment_secret(uint64_t this_arg) {
63449         LDKBolt11Invoice this_arg_conv;
63450         this_arg_conv.inner = untag_ptr(this_arg);
63451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63453         this_arg_conv.is_owned = false;
63454         int8_tArray ret_arr = init_int8_tArray(32, __LINE__);
63455         memcpy(ret_arr->elems, *Bolt11Invoice_payment_secret(&this_arg_conv), 32);
63456         return ret_arr;
63457 }
63458
63459 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_payment_metadata"))) TS_Bolt11Invoice_payment_metadata(uint64_t this_arg) {
63460         LDKBolt11Invoice this_arg_conv;
63461         this_arg_conv.inner = untag_ptr(this_arg);
63462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63464         this_arg_conv.is_owned = false;
63465         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
63466         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
63467         uint64_t ret_ref = tag_ptr(ret_copy, true);
63468         return ret_ref;
63469 }
63470
63471 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_features"))) TS_Bolt11Invoice_features(uint64_t this_arg) {
63472         LDKBolt11Invoice this_arg_conv;
63473         this_arg_conv.inner = untag_ptr(this_arg);
63474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63476         this_arg_conv.is_owned = false;
63477         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
63478         uint64_t ret_ref = 0;
63479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63481         return ret_ref;
63482 }
63483
63484 int8_tArray  __attribute__((export_name("TS_Bolt11Invoice_recover_payee_pub_key"))) TS_Bolt11Invoice_recover_payee_pub_key(uint64_t this_arg) {
63485         LDKBolt11Invoice this_arg_conv;
63486         this_arg_conv.inner = untag_ptr(this_arg);
63487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63489         this_arg_conv.is_owned = false;
63490         int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
63491         memcpy(ret_arr->elems, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form, 33);
63492         return ret_arr;
63493 }
63494
63495 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_expires_at"))) TS_Bolt11Invoice_expires_at(uint64_t this_arg) {
63496         LDKBolt11Invoice this_arg_conv;
63497         this_arg_conv.inner = untag_ptr(this_arg);
63498         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63500         this_arg_conv.is_owned = false;
63501         LDKCOption_DurationZ *ret_copy = MALLOC(sizeof(LDKCOption_DurationZ), "LDKCOption_DurationZ");
63502         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
63503         uint64_t ret_ref = tag_ptr(ret_copy, true);
63504         return ret_ref;
63505 }
63506
63507 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiry_time"))) TS_Bolt11Invoice_expiry_time(uint64_t this_arg) {
63508         LDKBolt11Invoice this_arg_conv;
63509         this_arg_conv.inner = untag_ptr(this_arg);
63510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63512         this_arg_conv.is_owned = false;
63513         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
63514         return ret_conv;
63515 }
63516
63517 int64_t  __attribute__((export_name("TS_Bolt11Invoice_expiration_remaining_from_epoch"))) TS_Bolt11Invoice_expiration_remaining_from_epoch(uint64_t this_arg, int64_t time) {
63518         LDKBolt11Invoice this_arg_conv;
63519         this_arg_conv.inner = untag_ptr(this_arg);
63520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63522         this_arg_conv.is_owned = false;
63523         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
63524         return ret_conv;
63525 }
63526
63527 jboolean  __attribute__((export_name("TS_Bolt11Invoice_would_expire"))) TS_Bolt11Invoice_would_expire(uint64_t this_arg, int64_t at_time) {
63528         LDKBolt11Invoice this_arg_conv;
63529         this_arg_conv.inner = untag_ptr(this_arg);
63530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63532         this_arg_conv.is_owned = false;
63533         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
63534         return ret_conv;
63535 }
63536
63537 int64_t  __attribute__((export_name("TS_Bolt11Invoice_min_final_cltv_expiry_delta"))) TS_Bolt11Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) {
63538         LDKBolt11Invoice this_arg_conv;
63539         this_arg_conv.inner = untag_ptr(this_arg);
63540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63542         this_arg_conv.is_owned = false;
63543         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
63544         return ret_conv;
63545 }
63546
63547 ptrArray  __attribute__((export_name("TS_Bolt11Invoice_fallback_addresses"))) TS_Bolt11Invoice_fallback_addresses(uint64_t this_arg) {
63548         LDKBolt11Invoice this_arg_conv;
63549         this_arg_conv.inner = untag_ptr(this_arg);
63550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63552         this_arg_conv.is_owned = false;
63553         LDKCVec_AddressZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
63554         ptrArray ret_arr = NULL;
63555         ret_arr = init_ptrArray(ret_var.datalen, __LINE__);
63556         jstring *ret_arr_ptr = (jstring*)(((uint8_t*)ret_arr) + 8);
63557         for (size_t i = 0; i < ret_var.datalen; i++) {
63558                 LDKStr ret_conv_8_str = ret_var.data[i];
63559                 jstring ret_conv_8_conv = str_ref_to_ts(ret_conv_8_str.chars, ret_conv_8_str.len);
63560                 Str_free(ret_conv_8_str);
63561                 ret_arr_ptr[i] = ret_conv_8_conv;
63562         }
63563         
63564         FREE(ret_var.data);
63565         return ret_arr;
63566 }
63567
63568 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_private_routes"))) TS_Bolt11Invoice_private_routes(uint64_t this_arg) {
63569         LDKBolt11Invoice this_arg_conv;
63570         this_arg_conv.inner = untag_ptr(this_arg);
63571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63573         this_arg_conv.is_owned = false;
63574         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
63575         uint64_tArray ret_arr = NULL;
63576         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63577         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63578         for (size_t o = 0; o < ret_var.datalen; o++) {
63579                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
63580                 uint64_t ret_conv_14_ref = 0;
63581                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
63582                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
63583                 ret_arr_ptr[o] = ret_conv_14_ref;
63584         }
63585         
63586         FREE(ret_var.data);
63587         return ret_arr;
63588 }
63589
63590 uint64_tArray  __attribute__((export_name("TS_Bolt11Invoice_route_hints"))) TS_Bolt11Invoice_route_hints(uint64_t this_arg) {
63591         LDKBolt11Invoice this_arg_conv;
63592         this_arg_conv.inner = untag_ptr(this_arg);
63593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63595         this_arg_conv.is_owned = false;
63596         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
63597         uint64_tArray ret_arr = NULL;
63598         ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
63599         uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
63600         for (size_t l = 0; l < ret_var.datalen; l++) {
63601                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
63602                 uint64_t ret_conv_11_ref = 0;
63603                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
63604                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
63605                 ret_arr_ptr[l] = ret_conv_11_ref;
63606         }
63607         
63608         FREE(ret_var.data);
63609         return ret_arr;
63610 }
63611
63612 uint32_t  __attribute__((export_name("TS_Bolt11Invoice_currency"))) TS_Bolt11Invoice_currency(uint64_t this_arg) {
63613         LDKBolt11Invoice this_arg_conv;
63614         this_arg_conv.inner = untag_ptr(this_arg);
63615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63617         this_arg_conv.is_owned = false;
63618         uint32_t ret_conv = LDKCurrency_to_js(Bolt11Invoice_currency(&this_arg_conv));
63619         return ret_conv;
63620 }
63621
63622 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_amount_milli_satoshis"))) TS_Bolt11Invoice_amount_milli_satoshis(uint64_t this_arg) {
63623         LDKBolt11Invoice this_arg_conv;
63624         this_arg_conv.inner = untag_ptr(this_arg);
63625         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63627         this_arg_conv.is_owned = false;
63628         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
63629         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
63630         uint64_t ret_ref = tag_ptr(ret_copy, true);
63631         return ret_ref;
63632 }
63633
63634 uint64_t  __attribute__((export_name("TS_Description_new"))) TS_Description_new(jstring description) {
63635         LDKStr description_conv = str_ref_to_owned_c(description);
63636         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
63637         *ret_conv = Description_new(description_conv);
63638         return tag_ptr(ret_conv, true);
63639 }
63640
63641 jstring  __attribute__((export_name("TS_Description_into_inner"))) TS_Description_into_inner(uint64_t this_arg) {
63642         LDKDescription this_arg_conv;
63643         this_arg_conv.inner = untag_ptr(this_arg);
63644         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63646         this_arg_conv = Description_clone(&this_arg_conv);
63647         LDKStr ret_str = Description_into_inner(this_arg_conv);
63648         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
63649         Str_free(ret_str);
63650         return ret_conv;
63651 }
63652
63653 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_seconds"))) TS_ExpiryTime_from_seconds(int64_t seconds) {
63654         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
63655         uint64_t ret_ref = 0;
63656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63658         return ret_ref;
63659 }
63660
63661 uint64_t  __attribute__((export_name("TS_ExpiryTime_from_duration"))) TS_ExpiryTime_from_duration(int64_t duration) {
63662         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
63663         uint64_t ret_ref = 0;
63664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63666         return ret_ref;
63667 }
63668
63669 int64_t  __attribute__((export_name("TS_ExpiryTime_as_seconds"))) TS_ExpiryTime_as_seconds(uint64_t this_arg) {
63670         LDKExpiryTime this_arg_conv;
63671         this_arg_conv.inner = untag_ptr(this_arg);
63672         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63674         this_arg_conv.is_owned = false;
63675         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
63676         return ret_conv;
63677 }
63678
63679 int64_t  __attribute__((export_name("TS_ExpiryTime_as_duration"))) TS_ExpiryTime_as_duration(uint64_t this_arg) {
63680         LDKExpiryTime this_arg_conv;
63681         this_arg_conv.inner = untag_ptr(this_arg);
63682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63684         this_arg_conv.is_owned = false;
63685         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
63686         return ret_conv;
63687 }
63688
63689 uint64_t  __attribute__((export_name("TS_PrivateRoute_new"))) TS_PrivateRoute_new(uint64_t hops) {
63690         LDKRouteHint hops_conv;
63691         hops_conv.inner = untag_ptr(hops);
63692         hops_conv.is_owned = ptr_is_owned(hops);
63693         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
63694         hops_conv = RouteHint_clone(&hops_conv);
63695         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
63696         *ret_conv = PrivateRoute_new(hops_conv);
63697         return tag_ptr(ret_conv, true);
63698 }
63699
63700 uint64_t  __attribute__((export_name("TS_PrivateRoute_into_inner"))) TS_PrivateRoute_into_inner(uint64_t this_arg) {
63701         LDKPrivateRoute this_arg_conv;
63702         this_arg_conv.inner = untag_ptr(this_arg);
63703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63705         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
63706         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
63707         uint64_t ret_ref = 0;
63708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63710         return ret_ref;
63711 }
63712
63713 uint32_t  __attribute__((export_name("TS_CreationError_clone"))) TS_CreationError_clone(uint64_t orig) {
63714         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
63715         uint32_t ret_conv = LDKCreationError_to_js(CreationError_clone(orig_conv));
63716         return ret_conv;
63717 }
63718
63719 uint32_t  __attribute__((export_name("TS_CreationError_description_too_long"))) TS_CreationError_description_too_long() {
63720         uint32_t ret_conv = LDKCreationError_to_js(CreationError_description_too_long());
63721         return ret_conv;
63722 }
63723
63724 uint32_t  __attribute__((export_name("TS_CreationError_route_too_long"))) TS_CreationError_route_too_long() {
63725         uint32_t ret_conv = LDKCreationError_to_js(CreationError_route_too_long());
63726         return ret_conv;
63727 }
63728
63729 uint32_t  __attribute__((export_name("TS_CreationError_timestamp_out_of_bounds"))) TS_CreationError_timestamp_out_of_bounds() {
63730         uint32_t ret_conv = LDKCreationError_to_js(CreationError_timestamp_out_of_bounds());
63731         return ret_conv;
63732 }
63733
63734 uint32_t  __attribute__((export_name("TS_CreationError_invalid_amount"))) TS_CreationError_invalid_amount() {
63735         uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount());
63736         return ret_conv;
63737 }
63738
63739 uint32_t  __attribute__((export_name("TS_CreationError_missing_route_hints"))) TS_CreationError_missing_route_hints() {
63740         uint32_t ret_conv = LDKCreationError_to_js(CreationError_missing_route_hints());
63741         return ret_conv;
63742 }
63743
63744 uint32_t  __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() {
63745         uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short());
63746         return ret_conv;
63747 }
63748
63749 jboolean  __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) {
63750         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
63751         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
63752         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
63753         return ret_conv;
63754 }
63755
63756 jstring  __attribute__((export_name("TS_CreationError_to_str"))) TS_CreationError_to_str(uint64_t o) {
63757         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
63758         LDKStr ret_str = CreationError_to_str(o_conv);
63759         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
63760         Str_free(ret_str);
63761         return ret_conv;
63762 }
63763
63764 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_clone"))) TS_Bolt11SemanticError_clone(uint64_t orig) {
63765         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
63766         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_clone(orig_conv));
63767         return ret_conv;
63768 }
63769
63770 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_hash"))) TS_Bolt11SemanticError_no_payment_hash() {
63771         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_hash());
63772         return ret_conv;
63773 }
63774
63775 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_hashes"))) TS_Bolt11SemanticError_multiple_payment_hashes() {
63776         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_hashes());
63777         return ret_conv;
63778 }
63779
63780 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_description"))) TS_Bolt11SemanticError_no_description() {
63781         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_description());
63782         return ret_conv;
63783 }
63784
63785 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_descriptions"))) TS_Bolt11SemanticError_multiple_descriptions() {
63786         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_descriptions());
63787         return ret_conv;
63788 }
63789
63790 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_no_payment_secret"))) TS_Bolt11SemanticError_no_payment_secret() {
63791         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_no_payment_secret());
63792         return ret_conv;
63793 }
63794
63795 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_multiple_payment_secrets"))) TS_Bolt11SemanticError_multiple_payment_secrets() {
63796         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_multiple_payment_secrets());
63797         return ret_conv;
63798 }
63799
63800 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_features"))) TS_Bolt11SemanticError_invalid_features() {
63801         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_features());
63802         return ret_conv;
63803 }
63804
63805 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_recovery_id"))) TS_Bolt11SemanticError_invalid_recovery_id() {
63806         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_recovery_id());
63807         return ret_conv;
63808 }
63809
63810 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_invalid_signature"))) TS_Bolt11SemanticError_invalid_signature() {
63811         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_invalid_signature());
63812         return ret_conv;
63813 }
63814
63815 uint32_t  __attribute__((export_name("TS_Bolt11SemanticError_imprecise_amount"))) TS_Bolt11SemanticError_imprecise_amount() {
63816         uint32_t ret_conv = LDKBolt11SemanticError_to_js(Bolt11SemanticError_imprecise_amount());
63817         return ret_conv;
63818 }
63819
63820 jboolean  __attribute__((export_name("TS_Bolt11SemanticError_eq"))) TS_Bolt11SemanticError_eq(uint64_t a, uint64_t b) {
63821         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
63822         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
63823         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
63824         return ret_conv;
63825 }
63826
63827 jstring  __attribute__((export_name("TS_Bolt11SemanticError_to_str"))) TS_Bolt11SemanticError_to_str(uint64_t o) {
63828         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
63829         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
63830         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
63831         Str_free(ret_str);
63832         return ret_conv;
63833 }
63834
63835 void  __attribute__((export_name("TS_SignOrCreationError_free"))) TS_SignOrCreationError_free(uint64_t this_ptr) {
63836         if (!ptr_is_owned(this_ptr)) return;
63837         void* this_ptr_ptr = untag_ptr(this_ptr);
63838         CHECK_ACCESS(this_ptr_ptr);
63839         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
63840         FREE(untag_ptr(this_ptr));
63841         SignOrCreationError_free(this_ptr_conv);
63842 }
63843
63844 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
63845         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
63846         *ret_copy = SignOrCreationError_clone(arg);
63847         uint64_t ret_ref = tag_ptr(ret_copy, true);
63848         return ret_ref;
63849 }
63850 int64_t  __attribute__((export_name("TS_SignOrCreationError_clone_ptr"))) TS_SignOrCreationError_clone_ptr(uint64_t arg) {
63851         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
63852         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
63853         return ret_conv;
63854 }
63855
63856 uint64_t  __attribute__((export_name("TS_SignOrCreationError_clone"))) TS_SignOrCreationError_clone(uint64_t orig) {
63857         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
63858         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
63859         *ret_copy = SignOrCreationError_clone(orig_conv);
63860         uint64_t ret_ref = tag_ptr(ret_copy, true);
63861         return ret_ref;
63862 }
63863
63864 uint64_t  __attribute__((export_name("TS_SignOrCreationError_sign_error"))) TS_SignOrCreationError_sign_error() {
63865         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
63866         *ret_copy = SignOrCreationError_sign_error();
63867         uint64_t ret_ref = tag_ptr(ret_copy, true);
63868         return ret_ref;
63869 }
63870
63871 uint64_t  __attribute__((export_name("TS_SignOrCreationError_creation_error"))) TS_SignOrCreationError_creation_error(uint32_t a) {
63872         LDKCreationError a_conv = LDKCreationError_from_js(a);
63873         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
63874         *ret_copy = SignOrCreationError_creation_error(a_conv);
63875         uint64_t ret_ref = tag_ptr(ret_copy, true);
63876         return ret_ref;
63877 }
63878
63879 jboolean  __attribute__((export_name("TS_SignOrCreationError_eq"))) TS_SignOrCreationError_eq(uint64_t a, uint64_t b) {
63880         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
63881         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
63882         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
63883         return ret_conv;
63884 }
63885
63886 jstring  __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOrCreationError_to_str(uint64_t o) {
63887         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
63888         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
63889         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
63890         Str_free(ret_str);
63891         return ret_conv;
63892 }
63893
63894 uint64_t  __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) {
63895         LDKBolt11Invoice invoice_conv;
63896         invoice_conv.inner = untag_ptr(invoice);
63897         invoice_conv.is_owned = ptr_is_owned(invoice);
63898         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
63899         invoice_conv.is_owned = false;
63900         void* retry_strategy_ptr = untag_ptr(retry_strategy);
63901         CHECK_ACCESS(retry_strategy_ptr);
63902         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
63903         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
63904         LDKChannelManager channelmanager_conv;
63905         channelmanager_conv.inner = untag_ptr(channelmanager);
63906         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
63907         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
63908         channelmanager_conv.is_owned = false;
63909         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
63910         *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv);
63911         return tag_ptr(ret_conv, true);
63912 }
63913
63914 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) {
63915         LDKBolt11Invoice invoice_conv;
63916         invoice_conv.inner = untag_ptr(invoice);
63917         invoice_conv.is_owned = ptr_is_owned(invoice);
63918         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
63919         invoice_conv.is_owned = false;
63920         LDKThirtyTwoBytes payment_id_ref;
63921         CHECK(payment_id->arr_len == 32);
63922         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63923         void* retry_strategy_ptr = untag_ptr(retry_strategy);
63924         CHECK_ACCESS(retry_strategy_ptr);
63925         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
63926         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
63927         LDKChannelManager channelmanager_conv;
63928         channelmanager_conv.inner = untag_ptr(channelmanager);
63929         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
63930         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
63931         channelmanager_conv.is_owned = false;
63932         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
63933         *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
63934         return tag_ptr(ret_conv, true);
63935 }
63936
63937 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) {
63938         LDKBolt11Invoice invoice_conv;
63939         invoice_conv.inner = untag_ptr(invoice);
63940         invoice_conv.is_owned = ptr_is_owned(invoice);
63941         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
63942         invoice_conv.is_owned = false;
63943         void* retry_strategy_ptr = untag_ptr(retry_strategy);
63944         CHECK_ACCESS(retry_strategy_ptr);
63945         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
63946         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
63947         LDKChannelManager channelmanager_conv;
63948         channelmanager_conv.inner = untag_ptr(channelmanager);
63949         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
63950         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
63951         channelmanager_conv.is_owned = false;
63952         LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ");
63953         *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv);
63954         return tag_ptr(ret_conv, true);
63955 }
63956
63957 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) {
63958         LDKBolt11Invoice invoice_conv;
63959         invoice_conv.inner = untag_ptr(invoice);
63960         invoice_conv.is_owned = ptr_is_owned(invoice);
63961         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
63962         invoice_conv.is_owned = false;
63963         LDKThirtyTwoBytes payment_id_ref;
63964         CHECK(payment_id->arr_len == 32);
63965         memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
63966         void* retry_strategy_ptr = untag_ptr(retry_strategy);
63967         CHECK_ACCESS(retry_strategy_ptr);
63968         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
63969         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
63970         LDKChannelManager channelmanager_conv;
63971         channelmanager_conv.inner = untag_ptr(channelmanager);
63972         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
63973         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
63974         channelmanager_conv.is_owned = false;
63975         LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ");
63976         *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv);
63977         return tag_ptr(ret_conv, true);
63978 }
63979
63980 void  __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) {
63981         if (!ptr_is_owned(this_ptr)) return;
63982         void* this_ptr_ptr = untag_ptr(this_ptr);
63983         CHECK_ACCESS(this_ptr_ptr);
63984         LDKPaymentError this_ptr_conv = *(LDKPaymentError*)(this_ptr_ptr);
63985         FREE(untag_ptr(this_ptr));
63986         PaymentError_free(this_ptr_conv);
63987 }
63988
63989 static inline uint64_t PaymentError_clone_ptr(LDKPaymentError *NONNULL_PTR arg) {
63990         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
63991         *ret_copy = PaymentError_clone(arg);
63992         uint64_t ret_ref = tag_ptr(ret_copy, true);
63993         return ret_ref;
63994 }
63995 int64_t  __attribute__((export_name("TS_PaymentError_clone_ptr"))) TS_PaymentError_clone_ptr(uint64_t arg) {
63996         LDKPaymentError* arg_conv = (LDKPaymentError*)untag_ptr(arg);
63997         int64_t ret_conv = PaymentError_clone_ptr(arg_conv);
63998         return ret_conv;
63999 }
64000
64001 uint64_t  __attribute__((export_name("TS_PaymentError_clone"))) TS_PaymentError_clone(uint64_t orig) {
64002         LDKPaymentError* orig_conv = (LDKPaymentError*)untag_ptr(orig);
64003         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
64004         *ret_copy = PaymentError_clone(orig_conv);
64005         uint64_t ret_ref = tag_ptr(ret_copy, true);
64006         return ret_ref;
64007 }
64008
64009 uint64_t  __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentError_invoice(jstring a) {
64010         LDKStr a_conv = str_ref_to_owned_c(a);
64011         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
64012         *ret_copy = PaymentError_invoice(a_conv);
64013         uint64_t ret_ref = tag_ptr(ret_copy, true);
64014         return ret_ref;
64015 }
64016
64017 uint64_t  __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) {
64018         LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a);
64019         LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError");
64020         *ret_copy = PaymentError_sending(a_conv);
64021         uint64_t ret_ref = tag_ptr(ret_copy, true);
64022         return ret_ref;
64023 }
64024
64025 jboolean  __attribute__((export_name("TS_PaymentError_eq"))) TS_PaymentError_eq(uint64_t a, uint64_t b) {
64026         LDKPaymentError* a_conv = (LDKPaymentError*)untag_ptr(a);
64027         LDKPaymentError* b_conv = (LDKPaymentError*)untag_ptr(b);
64028         jboolean ret_conv = PaymentError_eq(a_conv, b_conv);
64029         return ret_conv;
64030 }
64031
64032 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) {
64033         void* amt_msat_ptr = untag_ptr(amt_msat);
64034         CHECK_ACCESS(amt_msat_ptr);
64035         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64036         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64037         void* payment_hash_ptr = untag_ptr(payment_hash);
64038         CHECK_ACCESS(payment_hash_ptr);
64039         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
64040         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
64041         LDKStr description_conv = str_ref_to_owned_c(description);
64042         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
64043         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
64044         if (phantom_route_hints_constr.datalen > 0)
64045                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
64046         else
64047                 phantom_route_hints_constr.data = NULL;
64048         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
64049         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
64050                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
64051                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
64052                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
64053                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
64054                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
64055                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
64056                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
64057         }
64058         FREE(phantom_route_hints);
64059         void* entropy_source_ptr = untag_ptr(entropy_source);
64060         CHECK_ACCESS(entropy_source_ptr);
64061         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64062         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64063                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64064                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64065         }
64066         void* node_signer_ptr = untag_ptr(node_signer);
64067         CHECK_ACCESS(node_signer_ptr);
64068         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64069         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64070                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64071                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64072         }
64073         void* logger_ptr = untag_ptr(logger);
64074         CHECK_ACCESS(logger_ptr);
64075         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64076         if (logger_conv.free == LDKLogger_JCalls_free) {
64077                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64078                 LDKLogger_JCalls_cloned(&logger_conv);
64079         }
64080         LDKCurrency network_conv = LDKCurrency_from_js(network);
64081         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64082         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64083         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64084         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64085         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64086         *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);
64087         return tag_ptr(ret_conv, true);
64088 }
64089
64090 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) {
64091         void* amt_msat_ptr = untag_ptr(amt_msat);
64092         CHECK_ACCESS(amt_msat_ptr);
64093         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64094         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64095         void* payment_hash_ptr = untag_ptr(payment_hash);
64096         CHECK_ACCESS(payment_hash_ptr);
64097         LDKCOption_PaymentHashZ payment_hash_conv = *(LDKCOption_PaymentHashZ*)(payment_hash_ptr);
64098         payment_hash_conv = COption_PaymentHashZ_clone((LDKCOption_PaymentHashZ*)untag_ptr(payment_hash));
64099         LDKSha256 description_hash_conv;
64100         description_hash_conv.inner = untag_ptr(description_hash);
64101         description_hash_conv.is_owned = ptr_is_owned(description_hash);
64102         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
64103         description_hash_conv = Sha256_clone(&description_hash_conv);
64104         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
64105         phantom_route_hints_constr.datalen = phantom_route_hints->arr_len;
64106         if (phantom_route_hints_constr.datalen > 0)
64107                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
64108         else
64109                 phantom_route_hints_constr.data = NULL;
64110         uint64_t* phantom_route_hints_vals = phantom_route_hints->elems;
64111         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
64112                 uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
64113                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
64114                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
64115                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
64116                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
64117                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
64118                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
64119         }
64120         FREE(phantom_route_hints);
64121         void* entropy_source_ptr = untag_ptr(entropy_source);
64122         CHECK_ACCESS(entropy_source_ptr);
64123         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
64124         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
64125                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64126                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
64127         }
64128         void* node_signer_ptr = untag_ptr(node_signer);
64129         CHECK_ACCESS(node_signer_ptr);
64130         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64131         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64132                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64133                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64134         }
64135         void* logger_ptr = untag_ptr(logger);
64136         CHECK_ACCESS(logger_ptr);
64137         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64138         if (logger_conv.free == LDKLogger_JCalls_free) {
64139                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64140                 LDKLogger_JCalls_cloned(&logger_conv);
64141         }
64142         LDKCurrency network_conv = LDKCurrency_from_js(network);
64143         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64144         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64145         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64146         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64147         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64148         *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);
64149         return tag_ptr(ret_conv, true);
64150 }
64151
64152 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) {
64153         LDKChannelManager channelmanager_conv;
64154         channelmanager_conv.inner = untag_ptr(channelmanager);
64155         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
64156         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
64157         channelmanager_conv.is_owned = false;
64158         void* node_signer_ptr = untag_ptr(node_signer);
64159         CHECK_ACCESS(node_signer_ptr);
64160         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64161         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64162                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64163                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64164         }
64165         void* logger_ptr = untag_ptr(logger);
64166         CHECK_ACCESS(logger_ptr);
64167         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64168         if (logger_conv.free == LDKLogger_JCalls_free) {
64169                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64170                 LDKLogger_JCalls_cloned(&logger_conv);
64171         }
64172         LDKCurrency network_conv = LDKCurrency_from_js(network);
64173         void* amt_msat_ptr = untag_ptr(amt_msat);
64174         CHECK_ACCESS(amt_msat_ptr);
64175         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64176         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64177         LDKSha256 description_hash_conv;
64178         description_hash_conv.inner = untag_ptr(description_hash);
64179         description_hash_conv.is_owned = ptr_is_owned(description_hash);
64180         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
64181         description_hash_conv = Sha256_clone(&description_hash_conv);
64182         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64183         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64184         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64185         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64186         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64187         *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);
64188         return tag_ptr(ret_conv, true);
64189 }
64190
64191 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) {
64192         LDKChannelManager channelmanager_conv;
64193         channelmanager_conv.inner = untag_ptr(channelmanager);
64194         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
64195         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
64196         channelmanager_conv.is_owned = false;
64197         void* node_signer_ptr = untag_ptr(node_signer);
64198         CHECK_ACCESS(node_signer_ptr);
64199         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64200         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64201                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64202                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64203         }
64204         void* logger_ptr = untag_ptr(logger);
64205         CHECK_ACCESS(logger_ptr);
64206         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64207         if (logger_conv.free == LDKLogger_JCalls_free) {
64208                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64209                 LDKLogger_JCalls_cloned(&logger_conv);
64210         }
64211         LDKCurrency network_conv = LDKCurrency_from_js(network);
64212         void* amt_msat_ptr = untag_ptr(amt_msat);
64213         CHECK_ACCESS(amt_msat_ptr);
64214         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64215         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64216         LDKStr description_conv = str_ref_to_owned_c(description);
64217         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64218         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64219         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64220         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64221         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64222         *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);
64223         return tag_ptr(ret_conv, true);
64224 }
64225
64226 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) {
64227         LDKChannelManager channelmanager_conv;
64228         channelmanager_conv.inner = untag_ptr(channelmanager);
64229         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
64230         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
64231         channelmanager_conv.is_owned = false;
64232         void* node_signer_ptr = untag_ptr(node_signer);
64233         CHECK_ACCESS(node_signer_ptr);
64234         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
64235         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
64236                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64237                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
64238         }
64239         void* logger_ptr = untag_ptr(logger);
64240         CHECK_ACCESS(logger_ptr);
64241         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
64242         if (logger_conv.free == LDKLogger_JCalls_free) {
64243                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
64244                 LDKLogger_JCalls_cloned(&logger_conv);
64245         }
64246         LDKCurrency network_conv = LDKCurrency_from_js(network);
64247         void* amt_msat_ptr = untag_ptr(amt_msat);
64248         CHECK_ACCESS(amt_msat_ptr);
64249         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
64250         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
64251         LDKStr description_conv = str_ref_to_owned_c(description);
64252         LDKThirtyTwoBytes payment_hash_ref;
64253         CHECK(payment_hash->arr_len == 32);
64254         memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
64255         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
64256         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
64257         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
64258         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
64259         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
64260         *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);
64261         return tag_ptr(ret_conv, true);
64262 }
64263
64264 uint64_t  __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) {
64265         LDKStr s_conv = str_ref_to_owned_c(s);
64266         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
64267         *ret_conv = SiPrefix_from_str(s_conv);
64268         return tag_ptr(ret_conv, true);
64269 }
64270
64271 uint64_t  __attribute__((export_name("TS_Bolt11Invoice_from_str"))) TS_Bolt11Invoice_from_str(jstring s) {
64272         LDKStr s_conv = str_ref_to_owned_c(s);
64273         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
64274         *ret_conv = Bolt11Invoice_from_str(s_conv);
64275         return tag_ptr(ret_conv, true);
64276 }
64277
64278 uint64_t  __attribute__((export_name("TS_SignedRawBolt11Invoice_from_str"))) TS_SignedRawBolt11Invoice_from_str(jstring s) {
64279         LDKStr s_conv = str_ref_to_owned_c(s);
64280         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
64281         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
64282         return tag_ptr(ret_conv, true);
64283 }
64284
64285 jstring  __attribute__((export_name("TS_Bolt11ParseError_to_str"))) TS_Bolt11ParseError_to_str(uint64_t o) {
64286         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
64287         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
64288         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64289         Str_free(ret_str);
64290         return ret_conv;
64291 }
64292
64293 jstring  __attribute__((export_name("TS_ParseOrSemanticError_to_str"))) TS_ParseOrSemanticError_to_str(uint64_t o) {
64294         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
64295         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
64296         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64297         Str_free(ret_str);
64298         return ret_conv;
64299 }
64300
64301 jstring  __attribute__((export_name("TS_Bolt11Invoice_to_str"))) TS_Bolt11Invoice_to_str(uint64_t o) {
64302         LDKBolt11Invoice o_conv;
64303         o_conv.inner = untag_ptr(o);
64304         o_conv.is_owned = ptr_is_owned(o);
64305         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64306         o_conv.is_owned = false;
64307         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
64308         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64309         Str_free(ret_str);
64310         return ret_conv;
64311 }
64312
64313 jstring  __attribute__((export_name("TS_SignedRawBolt11Invoice_to_str"))) TS_SignedRawBolt11Invoice_to_str(uint64_t o) {
64314         LDKSignedRawBolt11Invoice o_conv;
64315         o_conv.inner = untag_ptr(o);
64316         o_conv.is_owned = ptr_is_owned(o);
64317         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64318         o_conv.is_owned = false;
64319         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
64320         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64321         Str_free(ret_str);
64322         return ret_conv;
64323 }
64324
64325 jstring  __attribute__((export_name("TS_Currency_to_str"))) TS_Currency_to_str(uint64_t o) {
64326         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
64327         LDKStr ret_str = Currency_to_str(o_conv);
64328         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64329         Str_free(ret_str);
64330         return ret_conv;
64331 }
64332
64333 jstring  __attribute__((export_name("TS_SiPrefix_to_str"))) TS_SiPrefix_to_str(uint64_t o) {
64334         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
64335         LDKStr ret_str = SiPrefix_to_str(o_conv);
64336         jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
64337         Str_free(ret_str);
64338         return ret_conv;
64339 }
64340